Package org.opensextant.data
Class Place
java.lang.Object
org.opensextant.data.GeoBase
org.opensextant.data.Place
- Direct Known Subclasses:
Country
Place class represents all the metadata about a location.
Such location could be static data such as that in the gazetteer or something
dynamic or fabricated on the fly.
- Author:
- Marc C. Ubaldino, MITRE, ubaldino at mitre dot org, David P. Lutz, MITRE, dlutz at mitre dot org
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
With multiple data sources there is no standard way of saying this place == that place.void
Copy the basic gazetteer metadata tovoid
This sets the default to non-null value.State-level postal code, the corresponds usually to ADM1int
Confidence metric is a normalized 100-point scale.get the country object; generally optional.Returns a dynamically formatted feature string C/CODE for class/code.This ensures at least a default hierarchichal path is set.int
The ID bias is a measure of the a priori likelihood that a mention of this name refers to this particular place.seegetInstanceId()
The method by which the geolocation was determined; GAZ, COUNTRY, etc.int
The name bias is a measure of the a priori likelihood that a mention of this place's name actually refers to a place.char
Returns a pre-computed Non-diacritic namefinal String
City-level postal code, that may be something like a zip.int
int
Get the relative precision of this feature; in meters of errorGet the original source of this information.boolean
boolean
isAdmin1()
Is this Place a State or Province?boolean
boolean
boolean
isCode()
boolean
isCoordinate: if this object represents a coordinateboolean
Is this Place a Country?boolean
isName()
test if Place is a "Name" -- not a code/abbrev or other.boolean
Is this Place a National Capital?boolean
isPlace()
boolean
if feature class for this location is 'P' for populated place.boolean
isPostal()
Determines if this feature instance is a postal zone, coded "A/POST"boolean
boolean
Alias for "isAbbreviation() || isCode()"boolean
isSpot()
boolean
macro for detecting ADM1 or ADM2boolean
boolean
sameBoundary
(Place otherGeo) Check if CC.AA coding of the features is the same.void
void
void
void
void
void
setAdminName
(String admName) void
setConfidence
(int c) Set confidence, a value on a 100 point scale, 0-100.void
Set the country object and the local country ID code.void
setCountryCode
(String cc) Compat: set country_id aka CountryCodevoid
setFeatureClass
(String cls) void
setFeatureCode
(String featCode) void
void
setId_bias
(int bias) void
setInstanceId
(String id) Use to identify a particular related object ID associated with this location.void
void
setName_bias
(int bias) void
setName_type
(char t) final void
setPlaceID
(String id) Wrapper around GeoBase.setKey for compatfinal void
setPlaceName
(String nm) void
void
setPopulation
(int p) void
setPrecision
(int prec) Xponents version of precision is number of meters of error, approximately.void
toString()
Generic label -- anything more sophisticated needs attention E.g.Methods inherited from class org.opensextant.data.GeoBase
getGeohash, getKey, getLatitude, getLongitude, getName, getNamenorm, hasCoordinate, setGeohash, setKey, setLatitude, setLatLon, setLongitude, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensextant.data.Geocoding
hasCoordinate
Methods inherited from interface org.opensextant.data.LatLon
getLatitude, getLongitude, setLatitude, setLongitude
-
Field Details
-
admin1
For normalization purposes tracking the Province may be helpful. Coordinate and Place both share this common field. However no need to create an intermediate parent-class yet. Province is termed ADM1 -- or the first level of administrative boundary -
admin2
-
name_type
protected char name_type -
country
-
country_id
-
adminName
-
admin1Name
-
admin2Name
-
method
-
-
Constructor Details
-
Place
Creates a new instance of GeoBase- Parameters:
placeId
- primary key or ID for this placenm
- place name
-
Place
public Place() -
Place
public Place(double lat, double lon)
-
-
Method Details
-
copyTo
Copy the basic gazetteer metadata to- Parameters:
p
-
-
isASCIIName
public boolean isASCIIName() -
isUppercaseName
public boolean isUppercaseName() -
setName_type
public void setName_type(char t) -
isName
public boolean isName()test if Place is a "Name" -- not a code/abbrev or other. Tests name_type == "N"- Returns:
-
isShortName
public boolean isShortName()Alias for "isAbbreviation() || isCode()"- Returns:
-
getName_type
public char getName_type() -
setCountry
Set the country object and the local country ID code.- Specified by:
setCountry
in interfaceGeocoding
- Parameters:
c
- Country object which contains or is associated with this Place.
-
getCountry
get the country object; generally optional.- Returns:
- the country object.
-
setCountryCode
Compat: set country_id aka CountryCode- Specified by:
setCountryCode
in interfaceGeocoding
- Parameters:
cc
- a country code. Caller's choice as far as code code standard used.
-
getCountryCode
- Specified by:
getCountryCode
in interfaceGeocoding
-
getFeatureClass
- Specified by:
getFeatureClass
in interfaceGeocoding
-
setFeatureClass
-
getFeatureCode
- Specified by:
getFeatureCode
in interfaceGeocoding
-
setFeatureCode
-
getFeatureDesignation
Returns a dynamically formatted feature string C/CODE for class/code. -
sameBoundary
Check if CC.AA coding of the features is the same.- Parameters:
otherGeo
-- Returns:
-
setPlaceID
Wrapper around GeoBase.setKey for compat- Parameters:
id
- place identity
-
getPlaceID
- Specified by:
getPlaceID
in interfaceGeocoding
-
setPlaceName
- Specified by:
setPlaceName
in interfaceGeocoding
-
getNDNamenorm
Returns a pre-computed Non-diacritic name- Returns:
-
getPlaceName
- Specified by:
getPlaceName
in interfaceGeocoding
-
getAdmin1
-
setAdmin1
-
getAdmin2
-
setAdmin2
-
getSource
Get the original source of this information.- Returns:
- source gazetteer
-
setSource
-
isAbbreviation
public boolean isAbbreviation()- Returns:
- true if name value here is an abbreviation, e.g., Mass.
-
isCode
public boolean isCode() -
isCountry
public boolean isCountry()Is this Place a Country? -
isPlace
public boolean isPlace() -
isCoordinate
public boolean isCoordinate()Description copied from interface:Geocoding
isCoordinate: if this object represents a coordinate- Specified by:
isCoordinate
in interfaceGeocoding
- Returns:
- true if geocoding represents a coordinate
-
isAdministrative
public boolean isAdministrative()- Specified by:
isAdministrative
in interfaceGeocoding
-
isPostal
public boolean isPostal()Determines if this feature instance is a postal zone, coded "A/POST" -
isUpperAdmin
public boolean isUpperAdmin()macro for detecting ADM1 or ADM2 -
isPopulated
public boolean isPopulated()if feature class for this location is 'P' for populated place. TODO: Not sure if this is part of Geocoding interface.- Returns:
- true if feature class is typically populated
-
isAdmin1
public boolean isAdmin1()Is this Place a State or Province?- Returns:
- - true if this is a State, Province or other first level admin area
-
isNationalCapital
public boolean isNationalCapital()Is this Place a National Capital?- Returns:
- - true if this is a a national Capital area
-
getName_bias
public int getName_bias()The name bias is a measure of the a priori likelihood that a mention of this place's name actually refers to a place.- Returns:
- name bias
-
setName_bias
public void setName_bias(int bias) - Parameters:
bias
- name bias, float
-
getId_bias
public int getId_bias()The ID bias is a measure of the a priori likelihood that a mention of this name refers to this particular place.- Returns:
- identity bias
-
setId_bias
public void setId_bias(int bias) - Parameters:
bias
- identity bias
-
toString
Description copied from class:GeoBase
Generic label -- anything more sophisticated needs attention E.g. to use Key + Name or just Key for a label would be very specific -
isSame
-
compareTo
With multiple data sources there is no standard way of saying this place == that place. So we compare features, locations, Ids, etc.- Parameters:
other
- another Place- Returns:
- 1 if other is greater than current; 0 if equal, -1 if lesser
-
setPrecision
public void setPrecision(int prec) Xponents version of precision is number of meters of error, approximately. precision = 15 means the lat/lon on this Place object is within 15 m of the true location. Likewise, a precision of "50000" means 50Km of error in the location.- Specified by:
setPrecision
in interfaceGeocoding
- Parameters:
prec
- , meters of error
-
getPrecision
public int getPrecision()Get the relative precision of this feature; in meters of error- Specified by:
getPrecision
in interfaceGeocoding
- Returns:
- precision, meters of error.
- See Also:
-
setMethod
-
getMethod
The method by which the geolocation was determined; GAZ, COUNTRY, etc. are typical methods for reference data XCoord or other tools can parse; so the exact method for such patterns should be revealed here. -
getAdminName
- Specified by:
getAdminName
in interfaceGeocoding
-
setAdminName
- Parameters:
admName
- name of the administrative boundary that contains this place.
-
getAdmin1Name
- Specified by:
getAdmin1Name
in interfaceGeocoding
-
getAdmin2Name
- Specified by:
getAdmin2Name
in interfaceGeocoding
-
setAdmin1Name
-
setAdmin2Name
-
getHierarchicalPath
This ensures at least a default hierarchichal path is set. -
setHierarchicalPath
-
defaultHierarchicalPath
public void defaultHierarchicalPath()This sets the default to non-null value. Default hieararchy is:CC.ADM1 CC "" (empty string)
-
isSpot
public boolean isSpot() -
setPopulation
public void setPopulation(int p) -
getPopulation
public int getPopulation() -
getAdmin1PostalCode
State-level postal code, the corresponds usually to ADM1- Specified by:
getAdmin1PostalCode
in interfaceGeocoding
- Returns:
- optional postal code
-
getPlacePostalCode
City-level postal code, that may be something like a zip. Thinking world-wide, not everyone calls these zipcodes, as in the US.- Specified by:
getPlacePostalCode
in interfaceGeocoding
- Returns:
- optional postal code
-
setAdmin1PostalCode
-
setPlacePostalCode
-
getConfidence
public int getConfidence()Description copied from interface:Geocoding
Confidence metric is a normalized 100-point scale. Xponents conventions are simple, so value of confidence is an integer.- Specified by:
getConfidence
in interfaceGeocoding
- Returns:
- value on a 100 point scale.
-
setConfidence
public void setConfidence(int c) Description copied from interface:Geocoding
Set confidence, a value on a 100 point scale, 0-100. Yes values above or below scale are allowed, however it may be difficult to compare such values. The intent is to normalize all confidence metrics to this relative scale for your application.- Specified by:
setConfidence
in interfaceGeocoding
- Parameters:
c
- confidence
-
setInstanceId
Use to identify a particular related object ID associated with this location. This is intended purely for processing applications (not for general purpose use, as in plotting placemarks). For example use Place.instanceId to link this place object with a mention of the place in a document. If the document mentions the place multiple times, you can be clear about which mention this instance matches.- Parameters:
id
-
-
getInstanceId
seegetInstanceId()
- Returns:
-