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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintWith multiple data sources there is no standard way of saying this place == that place.voidCopy the basic gazetteer metadata tovoidThis sets the default to non-null value.State-level postal code, the corresponds usually to ADM1intConfidence 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.intThe 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.intThe name bias is a measure of the a priori likelihood that a mention of this place's name actually refers to a place.charReturns a pre-computed Non-diacritic namefinal StringCity-level postal code, that may be something like a zip.intintGet the relative precision of this feature; in meters of errorGet the original source of this information.booleanbooleanisAdmin1()Is this Place a State or Province?booleanbooleanbooleanisCode()booleanisCoordinate: if this object represents a coordinatebooleanIs this Place a Country?booleanisName()test if Place is a "Name" -- not a code/abbrev or other.booleanIs this Place a National Capital?booleanisPlace()booleanif feature class for this location is 'P' for populated place.booleanisPostal()Determines if this feature instance is a postal zone, coded "A/POST"booleanbooleanAlias for "isAbbreviation() || isCode()"booleanisSpot()booleanmacro for detecting ADM1 or ADM2booleanbooleansameBoundary(Place otherGeo) Check if CC.AA coding of the features is the same.voidvoidvoidvoidvoidvoidsetAdminName(String admName) voidsetConfidence(int c) Set confidence, a value on a 100 point scale, 0-100.voidSet the country object and the local country ID code.voidsetCountryCode(String cc) Compat: set country_id aka CountryCodevoidsetFeatureClass(String cls) voidsetFeatureCode(String featCode) voidvoidsetId_bias(int bias) voidsetInstanceId(String id) Use to identify a particular related object ID associated with this location.voidvoidsetName_bias(int bias) voidsetName_type(char t) final voidsetPlaceID(String id) Wrapper around GeoBase.setKey for compatfinal voidsetPlaceName(String nm) voidvoidsetPopulation(int p) voidsetPrecision(int prec) Xponents version of precision is number of meters of error, approximately.voidtoString()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, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensextant.data.Geocoding
hasCoordinateMethods 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:
setCountryin 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:
setCountryCodein interfaceGeocoding- Parameters:
cc- a country code. Caller's choice as far as code code standard used.
-
getCountryCode
- Specified by:
getCountryCodein interfaceGeocoding
-
getFeatureClass
- Specified by:
getFeatureClassin interfaceGeocoding
-
setFeatureClass
-
getFeatureCode
- Specified by:
getFeatureCodein 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:
getPlaceIDin interfaceGeocoding
-
setPlaceName
- Specified by:
setPlaceNamein interfaceGeocoding
-
getNDNamenorm
Returns a pre-computed Non-diacritic name- Returns:
-
getPlaceName
- Specified by:
getPlaceNamein 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:GeocodingisCoordinate: if this object represents a coordinate- Specified by:
isCoordinatein interfaceGeocoding- Returns:
- true if geocoding represents a coordinate
-
isAdministrative
public boolean isAdministrative()- Specified by:
isAdministrativein 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:GeoBaseGeneric 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:
setPrecisionin interfaceGeocoding- Parameters:
prec- , meters of error
-
getPrecision
public int getPrecision()Get the relative precision of this feature; in meters of error- Specified by:
getPrecisionin 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:
getAdminNamein interfaceGeocoding
-
setAdminName
- Parameters:
admName- name of the administrative boundary that contains this place.
-
getAdmin1Name
- Specified by:
getAdmin1Namein interfaceGeocoding
-
getAdmin2Name
- Specified by:
getAdmin2Namein 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:
getAdmin1PostalCodein 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:
getPlacePostalCodein interfaceGeocoding- Returns:
- optional postal code
-
setAdmin1PostalCode
-
setPlacePostalCode
-
getConfidence
public int getConfidence()Description copied from interface:GeocodingConfidence metric is a normalized 100-point scale. Xponents conventions are simple, so value of confidence is an integer.- Specified by:
getConfidencein interfaceGeocoding- Returns:
- value on a 100 point scale.
-
setConfidence
public void setConfidence(int c) Description copied from interface:GeocodingSet 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:
setConfidencein 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:
-