Package org.opensextant.data
Class Place
- java.lang.Object
-
- org.opensextant.data.GeoBase
-
- org.opensextant.data.Place
-
- Direct Known Subclasses:
Country
public class Place extends GeoBase implements Geocoding
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 Modifier and Type Field Description protected java.lang.String
admin1
For normalization purposes tracking the Province may be helpful.protected java.lang.String
admin1Name
protected java.lang.String
admin2
protected java.lang.String
admin2Name
protected java.lang.String
adminName
protected Country
country
protected java.lang.String
country_id
protected java.lang.String
method
protected char
name_type
-
Method Summary
Modifier and Type Method Description int
compareTo(Place other)
With multiple data sources there is no standard way of saying this place == that place.void
copyTo(Place p)
Copy the basic gazetteer metadata tovoid
defaultHierarchicalPath()
This sets the default to non-null value.java.lang.String
getAdmin1()
java.lang.String
getAdmin1Name()
java.lang.String
getAdmin1PostalCode()
State-level postal code, the corresponds usually to ADM1java.lang.String
getAdmin2()
java.lang.String
getAdmin2Name()
java.lang.String
getAdminName()
int
getConfidence()
Confidence metric is a normalized 100-point scale.Country
getCountry()
get the country object; generally optional.java.lang.String
getCountryCode()
java.lang.String
getFeatureClass()
java.lang.String
getFeatureCode()
java.lang.String
getFeatureDesignation()
Returns a dynamically formatted feature string C/CODE for class/code.java.lang.String
getHierarchicalPath()
This ensures at least a default hierarchichal path is set.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.java.lang.String
getInstanceId()
seegetInstanceId()
java.lang.String
getMethod()
The method by which the geolocation was determined; GAZ, COUNTRY, etc.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.char
getName_type()
java.lang.String
getNDNamenorm()
Returns a pre-computed Non-diacritic namejava.lang.String
getPlaceID()
java.lang.String
getPlaceName()
java.lang.String
getPlacePostalCode()
City-level postal code, that may be something like a zip.int
getPopulation()
int
getPrecision()
Get the relative precision of this feature; in meters of errorjava.lang.String
getSource()
Get the original source of this information.boolean
isAbbreviation()
boolean
isAdmin1()
Is this Place a State or Province?boolean
isAdministrative()
boolean
isASCIIName()
boolean
isCode()
boolean
isCoordinate()
isCoordinate: if this object represents a coordinateboolean
isCountry()
Is this Place a Country?boolean
isName()
test if Place is a "Name" -- not a code/abbrev or other.boolean
isNationalCapital()
Is this Place a National Capital?boolean
isPlace()
boolean
isPopulated()
if feature class for this location is 'P' for populated place.boolean
isSame(Place other)
boolean
isShortName()
Alias for "isAbbreviation() || isCode()"boolean
isSpot()
boolean
isUpperAdmin()
macro for detecting ADM1 or ADM2boolean
isUppercaseName()
boolean
sameBoundary(Place otherGeo)
Check if CC.AA coding of the features is the same.void
setAdmin1(java.lang.String key)
void
setAdmin1Name(java.lang.String n)
void
setAdmin1PostalCode(java.lang.String c)
void
setAdmin2(java.lang.String key)
void
setAdmin2Name(java.lang.String n)
void
setAdminName(java.lang.String admName)
void
setConfidence(int c)
Set confidence, a value on a 100 point scale, 0-100.void
setCountry(Country c)
Set the country object and the local country ID code.void
setCountryCode(java.lang.String cc)
Compat: set country_id aka CountryCodevoid
setFeatureClass(java.lang.String cls)
void
setFeatureCode(java.lang.String featCode)
void
setHierarchicalPath(java.lang.String p)
void
setId_bias(int bias)
void
setInstanceId(java.lang.String id)
Use to identify a particular related object ID associated with this location.void
setMethod(java.lang.String m)
void
setName_bias(int bias)
void
setName_type(char t)
void
setPlaceID(java.lang.String id)
Wrapper around GeoBase.setKey for compatvoid
setPlaceName(java.lang.String nm)
void
setPlacePostalCode(java.lang.String c)
void
setPopulation(int p)
void
setPrecision(int prec)
Xponents version of precision is number of meters of error, approximately.void
setSource(java.lang.String src)
java.lang.String
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 Detail
-
admin1
protected java.lang.String 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
protected java.lang.String admin2
-
name_type
protected char name_type
-
country
protected Country country
-
country_id
protected java.lang.String country_id
-
adminName
protected java.lang.String adminName
-
admin1Name
protected java.lang.String admin1Name
-
admin2Name
protected java.lang.String admin2Name
-
method
protected java.lang.String method
-
-
Method Detail
-
copyTo
public void copyTo(Place p)
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
public void setCountry(Country c)
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
public Country getCountry()
get the country object; generally optional.- Returns:
- the country object.
-
setCountryCode
public void setCountryCode(java.lang.String cc)
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
public java.lang.String getCountryCode()
- Specified by:
getCountryCode
in interfaceGeocoding
-
getFeatureClass
public java.lang.String getFeatureClass()
- Specified by:
getFeatureClass
in interfaceGeocoding
-
setFeatureClass
public void setFeatureClass(java.lang.String cls)
-
getFeatureCode
public java.lang.String getFeatureCode()
- Specified by:
getFeatureCode
in interfaceGeocoding
-
setFeatureCode
public void setFeatureCode(java.lang.String featCode)
-
getFeatureDesignation
public java.lang.String getFeatureDesignation()
Returns a dynamically formatted feature string C/CODE for class/code.
-
sameBoundary
public boolean sameBoundary(Place otherGeo)
Check if CC.AA coding of the features is the same.- Parameters:
otherGeo
-- Returns:
-
setPlaceID
public final void setPlaceID(java.lang.String id)
Wrapper around GeoBase.setKey for compat- Parameters:
id
- place identity
-
getPlaceID
public java.lang.String getPlaceID()
- Specified by:
getPlaceID
in interfaceGeocoding
-
setPlaceName
public final void setPlaceName(java.lang.String nm)
- Specified by:
setPlaceName
in interfaceGeocoding
-
getNDNamenorm
public java.lang.String getNDNamenorm()
Returns a pre-computed Non-diacritic name- Returns:
-
getPlaceName
public final java.lang.String getPlaceName()
- Specified by:
getPlaceName
in interfaceGeocoding
-
setAdmin1
public void setAdmin1(java.lang.String key)
-
setAdmin2
public void setAdmin2(java.lang.String key)
-
getSource
public java.lang.String getSource()
Get the original source of this information.- Returns:
- source gazetteer
-
setSource
public void setSource(java.lang.String src)
-
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
-
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
public java.lang.String 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
public boolean isSame(Place other)
-
compareTo
public int compareTo(Place other)
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:
setPrecision(int)
-
getMethod
public java.lang.String 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
public java.lang.String getAdminName()
- Specified by:
getAdminName
in interfaceGeocoding
-
setAdminName
public void setAdminName(java.lang.String admName)
- Parameters:
admName
- name of the administrative boundary that contains this place.
-
getAdmin1Name
public java.lang.String getAdmin1Name()
- Specified by:
getAdmin1Name
in interfaceGeocoding
-
getAdmin2Name
public java.lang.String getAdmin2Name()
- Specified by:
getAdmin2Name
in interfaceGeocoding
-
setAdmin1Name
public void setAdmin1Name(java.lang.String n)
-
setAdmin2Name
public void setAdmin2Name(java.lang.String n)
-
getHierarchicalPath
public java.lang.String getHierarchicalPath()
This ensures at least a default hierarchichal path is set.
-
setHierarchicalPath
public void setHierarchicalPath(java.lang.String p)
-
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
public java.lang.String getAdmin1PostalCode()
State-level postal code, the corresponds usually to ADM1- Specified by:
getAdmin1PostalCode
in interfaceGeocoding
- Returns:
- optional postal code
-
getPlacePostalCode
public java.lang.String 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
public void setAdmin1PostalCode(java.lang.String c)
-
setPlacePostalCode
public void setPlacePostalCode(java.lang.String c)
-
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
public void setInstanceId(java.lang.String id)
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
public java.lang.String getInstanceId()
seegetInstanceId()
- Returns:
-
-