public class GeoName extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
OUT_OF_BOUNDS |
| Constructor and Description |
|---|
GeoName(int geonameID,
String name,
String asciiName,
List<String> alternateNames,
String preferredName,
Double latitude,
Double longitude,
FeatureClass featureClass,
FeatureCode featureCode,
CountryCode primaryCountryCode,
List<CountryCode> alternateCountryCodes,
String admin1Code,
String admin2Code,
String admin3Code,
String admin4Code,
Long population,
Integer elevation,
Integer digitalElevationModel,
TimeZone timezone,
Date modificationDate,
String gazetteerRecord)
Sole constructor for
GeoName class. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
String |
getAdmin1Code()
Get the code for the first level administrative division (e.g.
|
String |
getAdmin2Code()
Get the code for the second level administrative division (e.g.
|
String |
getAdmin3Code()
Get the code for the third level administrative division.
|
String |
getAdmin4Code()
Get the code for the fourth level administrative division.
|
List<CountryCode> |
getAlternateCountryCodes()
Get the alternate ISO-3166 2-letter country codes.
|
List<String> |
getAlternateNames()
Get the alternate names for the location.
|
String |
getAncestryKey()
Get the ancestry key that can be used to identify this administrative division.
|
String |
getAsciiName()
Get the name of the geographical point in plain ascii characters.
|
int |
getDigitalElevationModel()
Get the digital elevation model, srtm3 or gtopo30, average
elevation of 3''x3'' (ca 90mx90m) or 30''x30'' (ca 900mx900m)
area in meters, integer.
|
int |
getElevation()
Get the elevation in meters.
|
FeatureClass |
getFeatureClass()
Get the major feature category.
|
FeatureCode |
getFeatureCode()
Get the feature code.
|
String |
getGazetteerRecord()
Get the gazetteer record for this GeoName.
|
String |
getGazetteerRecordWithAncestry()
Get the gazetteer records for this GeoName and its ancestors, separated
by newline characters.
|
int |
getGeonameID()
Get the ID of the record in geonames database.
|
double |
getLatitude()
Get the latitude in decimal degrees.
|
double |
getLongitude()
Get the longitude in decimal degrees.
|
Date |
getModificationDate()
Get the last modification date in the GeoNames database.
|
String |
getName()
Get the name of the geographical point (UTF-8).
|
GeoName |
getParent()
Get the parent of this GeoName.
|
String |
getParentAncestryKey()
Get the ancestry key that can be used to identify the direct administrative
parent of this GeoName.
|
long |
getPopulation()
Get the total number of inhabitants.
|
String |
getPreferredName()
Gets the preferred name of this GeoName, if configured,
otherwise returns the name.
|
CountryCode |
getPrimaryCountryCode()
Get the primary ISO-3166 2-letter country code.
|
String |
getPrimaryCountryName() |
TimeZone |
getTimezone()
Get the time zone for the geographical point.
|
int |
hashCode() |
boolean |
isAncestorOf(GeoName geoname)
Is this GeoName an ancestor of the provided GeoName?
|
boolean |
isAncestryResolved()
Check to see if the ancestry hierarchy has been completely resolved for this GeoName.
|
boolean |
isDescendantOf(GeoName geoname)
Is this GeoName a descendant of the provided GeoName?
|
boolean |
isTopLevelAdminDivision()
Is this GeoName a top-level administrative division (e.g.
|
boolean |
isTopLevelTerritory()
Is this GeoName a top-level territory? A GeoName is considered to be a
top-level territory if it is an A:TERR record and the name assigned to
its primary country code is either the name of the GeoName or one of its
configured alternate names.
|
static GeoName |
parseFromGeoNamesRecord(String inputLine)
Builds a
GeoName object based on a single gazetteer
record in the GeoNames geographical database. |
static GeoName |
parseFromGeoNamesRecord(String inputLine,
String preferredName)
Builds a
GeoName object based on a single gazetteer
record in the GeoNames geographical database. |
boolean |
setParent(GeoName prnt)
Set the parent of this GeoName.
|
String |
toString()
For pretty-printing.
|
public static final int OUT_OF_BOUNDS
public GeoName(int geonameID,
String name,
String asciiName,
List<String> alternateNames,
String preferredName,
Double latitude,
Double longitude,
FeatureClass featureClass,
FeatureCode featureCode,
CountryCode primaryCountryCode,
List<CountryCode> alternateCountryCodes,
String admin1Code,
String admin2Code,
String admin3Code,
String admin4Code,
Long population,
Integer elevation,
Integer digitalElevationModel,
TimeZone timezone,
Date modificationDate,
String gazetteerRecord)
GeoName class.
Encapsulates a gazetteer record from the GeoNames database.geonameID - unique identifiername - name of this locationasciiName - plain text version of namealternateNames - list of alternate names, if anypreferredName - the preferred name, if knownlatitude - lat coordlongitude - lon coordfeatureClass - general type of feature (e.g., "Populated place")featureCode - specific type of feature (e.g., "capital of a political entity")primaryCountryCode - ISO country codealternateCountryCodes - list of alternate country codes, if any (i.e., disputed territories)admin1Code - FIPS code for first-level administrative subdivision (e.g., state or province)admin2Code - second-level administrative subdivision (e.g., county)admin3Code - third-level administrative subdivisionadmin4Code - fourth-level administrative subdivisionpopulation - number of inhabitantselevation - elevation in metersdigitalElevationModel - another way to measure elevationtimezone - timezone for this locationmodificationDate - date of last modification for the GeoNames recordgazetteerRecord - the gazetteer recordpublic String getPrimaryCountryName()
public static GeoName parseFromGeoNamesRecord(String inputLine)
GeoName object based on a single gazetteer
record in the GeoNames geographical database.inputLine - single line of tab-delimited text representing one record from the GeoNames gazetteerpublic static GeoName parseFromGeoNamesRecord(String inputLine, String preferredName)
GeoName object based on a single gazetteer
record in the GeoNames geographical database.inputLine - single line of tab-delimited text representing one record from the GeoNames gazetteerpreferredName - the preferred name of this GeoName as indicated by the GeoNames alternate names tablepublic String getParentAncestryKey()
getAncestryKey() for a description
of an ancestry key.
For example, the GeoName "Reston, VA" is found in
the hierarchy:
getAncestryKey() for the GeoName "Fairfax County."null for top-level elements such as countriespublic String getAncestryKey()
null for all feature types except the following
FeatureClass.A records:
FeatureCode.PCL)FeatureCode.ADM1)FeatureCode.ADM2)FeatureCode.ADM3)FeatureCode.ADM4)null)null if this
GeoName is not an administrative division or its ancestry key cannot be derived.public boolean isTopLevelAdminDivision()
true if this is a top-level administrative divisionpublic boolean isTopLevelTerritory()
true if the GeoName is a top level territorypublic boolean isDescendantOf(GeoName geoname)
geoname - the GeoName to testtrue if the provided GeoName is hierarchically an ancestor of this GeoNamepublic boolean isAncestorOf(GeoName geoname)
geoname - the GeoName to testtrue if this GeoName is hierarchically an ancestor of the provided GeoNamepublic GeoName getParent()
public boolean setParent(GeoName prnt)
prnt - the parent; if provided, parent.getAncestryKey() must
match this.getParentAncestryKey(); null
is ignoredtrue if the parent was set, false if
the parent was not the valid parent for this GeoNamepublic boolean isAncestryResolved()
true if all administrative parents have been resolvedpublic int getGeonameID()
public String getName()
public String getAsciiName()
public List<String> getAlternateNames()
public String getPreferredName()
public double getLatitude()
public double getLongitude()
public FeatureClass getFeatureClass()
public FeatureCode getFeatureCode()
public CountryCode getPrimaryCountryCode()
public List<CountryCode> getAlternateCountryCodes()
public String getAdmin1Code()
public String getAdmin2Code()
public String getAdmin3Code()
public String getAdmin4Code()
public long getPopulation()
public int getElevation()
public int getDigitalElevationModel()
public TimeZone getTimezone()
nullpublic Date getModificationDate()
nullpublic String getGazetteerRecord()
public String getGazetteerRecordWithAncestry()
Copyright © 2012–2014 Berico Technologies. All rights reserved.