public class GeoNamesLocator extends GeoLocator
Constructor and Description |
---|
GeoNamesLocator()
Create the GeoNamesLocator
|
GeoNamesLocator(java.lang.String path)
Create the GeoNamesLocator with the specified path
|
Modifier and Type | Method and Description |
---|---|
protected static java.util.Map<java.lang.String,GeoObject> |
getCache()
Get the cache.
|
GeoCoord |
getCoordinate(java.lang.String locName)
Request the geographic coordinate from the GeoNames Map server.
|
java.lang.String |
getCountry(java.lang.String locName)
Get the country containing the named location.
|
GeoFeatureType |
getFeatureType(java.lang.String locName)
Get the feature type for the location name.
|
GeoObject |
getGeoObject(java.lang.String locName)
Get the geographic object for the given location name.
|
java.lang.String |
getGeoPath()
Get the geonames path.
|
java.lang.String |
getRealName(java.lang.String locName)
Get the real name known by GeoNames for the location name.
|
boolean |
isEstimateFlag()
Return whether the locator allows estimation
|
boolean |
isLoaded()
Return whether the cache has been fully loaded
|
boolean |
isRetryFlag()
Return whether the locator allows retrying if the servers are busy
|
void |
loadCache()
Loads the entire file into the cache.
|
GeoShape |
lookup(Location loc)
Look up the shape associated with the specified Location
|
GeoShape |
lookup(java.lang.String locName)
Look up the shape associated with the specified Location by name
|
GeoShape |
lookup(java.lang.String locName,
java.lang.String type)
Look up the shape associated with the specified Location by name and
type
|
void |
setEstimateFlag(boolean estimateFlag)
Set the flag indicating whether to allow estimation within the locator.
|
void |
setFeatureClass(java.lang.String featureClasses)
Set the feature classes this locator will use.
|
void |
setGeoPath(java.lang.String path)
Set the base GeoNames path.
|
void |
setRetryFlag(boolean retryFlag)
Set the flag indicating whether to allow retrying when the servers are
too busy.
|
public GeoNamesLocator()
public GeoNamesLocator(java.lang.String path)
path
- the path to the GeoNames file or URLpublic GeoCoord getCoordinate(java.lang.String locName)
getCoordinate
in class GeoLocator
locName
- Location name.public java.lang.String getCountry(java.lang.String locName)
locName
- the location namepublic GeoFeatureType getFeatureType(java.lang.String locName)
getFeatureType
in class GeoLocator
locName
- the location namepublic GeoObject getGeoObject(java.lang.String locName)
locName
- the location namepublic java.lang.String getGeoPath()
public java.lang.String getRealName(java.lang.String locName)
locName
- the location namepublic boolean isEstimateFlag()
isEstimateFlag
in class GeoLocator
public boolean isLoaded()
public boolean isRetryFlag()
public void loadCache()
public GeoShape lookup(Location loc)
lookup
in class GeoLocator
loc
- the specified location objectpublic GeoShape lookup(java.lang.String locName)
lookup
in class GeoLocator
locName
- the specified location namepublic GeoShape lookup(java.lang.String locName, java.lang.String type)
lookup
in class GeoLocator
locName
- the specified location nametype
- the type of location the name representspublic void setEstimateFlag(boolean estimateFlag)
setEstimateFlag
in class GeoLocator
estimateFlag
- whether the locator allows estimationpublic void setFeatureClass(java.lang.String featureClasses)
featureClasses
- A string containing single letter codes.public void setGeoPath(java.lang.String path)
path
- the new base for the geonames URL, or the local geoFile.public void setRetryFlag(boolean retryFlag)
retryFlag
- whether the locator allows retryingprotected static java.util.Map<java.lang.String,GeoObject> getCache()