com.gisgraphy.domain.geoloc.entity
Class GisFeature

java.lang.Object
  extended by com.gisgraphy.domain.geoloc.entity.GisFeature
Direct Known Subclasses:
Adm, Airport, AmusePark, Aqueduc, ATM, Bank, Bar, Bay, Beach, Bridge, Building, BusStation, Camp, Canyon, Casino, Castle, Cemetery, Cirque, City, CitySubdivision, Cliff, Coast, Continent, Country, CourtHouse, CustomsPost, Dam, Desert, Factory, Falls, Farm, Field, FishingArea, Fjord, Forest, Garden, Golf, Gorge, GrassLand, Gulf, Hill, Hospital, Hotel, House, Ice, Island, Lake, Library, LightHouse, Mall, Marsh, MetroStation, Military, Mill, Mine, Mole, Monument, Mound, Mountain, Museum, Oasis, ObservatoryPoint, Ocean, OperaHouse, Park, Parking, Plantation, PolicePost, PoliticalEntity, Pond, Port, PostOffice, Prison, Pyramid, Quay, Rail, RailRoadStation, Ranch, Ravin, Reef, Religious, Reserve, Restaurant, Road, School, Sea, Spring, Stadium, Strait, Stream, Street, Theater, Tower, Tree, Tunnel, UnderSea, Vineyard, Volcano, WaterBody, Zoo

@Configurable
public class GisFeature
extends java.lang.Object

GisFeature is the 'MotherClass of all Features. IMPORTANT Note about admXCodes :
The AdmCode can have the value from the Geonames CSV file or the value from the getAdm().getAdm1Code It depends on the option ImporterConfig.isSyncAdmCodesWithLinkedAdmOnes() in the env.properties file : Gisgraphy try to detect and correct errors in the CSV files. If an error is detected or wrong Adm code are set, the Adm for this GisFeature may not be the one that will be found from the Code in the CSV file. If syncAdmCodesWithLinkedAdmOnes is set to false, the Adm1Code will be set with the value of the CSV file (even if the no Adm are found).
If syncAdmCodesWithLinkedAdmOnes is set to true then the Adm1Code will always be the same as the getAdm().getAdm1Code
It depends on what you expect for Adm1Code : ADM values (syncAdmCodesWithLinkedAdmOnes=true) or the CSV one (syncAdmCodesWithLinkedAdmOnes=false)

Author:
David Masclet
See Also:
ImporterConfig

Field Summary
 ICountryDao countryDao
           
static java.lang.String LOCATION_COLUMN_NAME
           
protected static org.slf4j.Logger logger
           
 
Constructor Summary
GisFeature()
          Default Constructor, needed by cgLib
GisFeature(GisFeature gisFeature)
          Copy Constructor that populate the current GisFeature with the specified gisFeature fields
 
Method Summary
 void addAlternateName(AlternateName alternateName)
          Do a double set : add the alternate name to the current GisFeature and set this GisFeature as the GisFeature of the specified AlternateName
 void addAlternateNames(java.util.List<AlternateName> alternateNames)
          Do a double set : add (not replace !)
 void addZipCode(ZipCode zipCode)
          Do a double set : add the zip code to the current GisFeature and set this GisFeature as the GisFeature of the zipcode
 void addZipCodes(java.util.List<ZipCode> zipCodes)
          Do a double set : add the zip codes to the current GisFeature and set this GisFeature as the GisFeature of the zipcodes * @param zipCodes the zip codes to add
 double distanceTo(com.vividsolutions.jts.geom.Point point)
          Calculate the distance from the current GisFeature to the specified point.
 boolean equals(java.lang.Object obj)
           
 Adm getAdm()
           
 java.lang.String getAdm1Code()
          Returns the Adm1Code for this feature.
 java.lang.String getAdm1Name()
          Returns the name of the Adm of level 1 that this GisFeature is linked to.
 java.lang.String getAdm2Code()
          Returns the Adm2Code for this feature.
 java.lang.String getAdm2Name()
          Returns the name of the Adm of level 2 that this GisFeature is linked to.
 java.lang.String getAdm3Code()
          Returns the Adm3Code for this feature.
 java.lang.String getAdm3Name()
          Returns the name of the Adm of level 3 that this GisFeature is linked to.
 java.lang.String getAdm4Code()
          Returns the Adm4Code for this feature.
 java.lang.String getAdm4Name()
          Returns the name of the Adm of level 4 that this GisFeature is linked to.
 java.util.List<AlternateName> getAlternateNames()
           
 java.lang.String getAsciiName()
           
 Country getCountry()
           
 java.lang.String getCountryCode()
          The country code is not mandatory because gisfeature like undersea does not belongs to a country
 java.lang.Integer getElevation()
           
 java.lang.String getFeatureClass()
           
 java.lang.String getFeatureCode()
           
 java.lang.Long getFeatureId()
           
 java.lang.String getFullyQualifiedName()
           
 java.lang.String getFullyQualifiedName(boolean withCountry)
          Returns a name of the form : (adm1Name et adm2Name are printed) Paris, Département de Ville-De-Paris, Ile-De-France, (FR)
 java.lang.Integer getGtopo30()
           
 java.lang.Long getId()
          The datastore id
 java.lang.Double getLatitude()
           
 com.vividsolutions.jts.geom.Point getLocation()
          Returns The JTS location point of the current GisFeature : The Geometry representation of the latitude, longitude.
 java.lang.Double getLongitude()
           
 java.util.Date getModificationDate()
          The modification date of the feature.
 java.lang.String getName()
           
 java.lang.Integer getPopulation()
           
 GISSource getSource()
           
 java.lang.String getTimezone()
           
 java.util.List<ZipCode> getZipCodes()
           
 int hashCode()
           
 boolean isAdm()
          Whether the feature is an Adm, in the sense we define it in the FeatureClassCodeHelper class.
 boolean isCity()
          Whether the feature is a city, in the sense we define it in the FeatureClassCodeHelper class.
 boolean isCountry()
          Whether the feature is a coutry, in the sense we define it in the FeatureClassCodeHelper class.
 boolean isFullTextSearchable()
           
 void populate(GisFeature gisFeature)
          Populate all the field / association of the current gisFeature with The Value of The specified One.
 void setAdm(Adm adm)
           
 void setAdm1Code(java.lang.String adm1Code)
           
 void setAdm1Name(java.lang.String adm1Name)
          Set the name of the Adm of level 1 that this GisFeature is linked to
 void setAdm2Code(java.lang.String adm2Code)
           
 void setAdm2Name(java.lang.String adm2Name)
          Set the name of the Adm of level 2 that this GisFeature is linked to
 void setAdm3Code(java.lang.String adm3Code)
           
 void setAdm3Name(java.lang.String adm3Name)
          Set the name of the Adm of level 3 that this GisFeature is linked to
 void setAdm4Code(java.lang.String adm4Code)
           
 void setAdm4Name(java.lang.String adm4Name)
          Set The name of the adm of level 4 that the GisFeature is linked to
 void setAlternateNames(java.util.List<AlternateName> alternateNames)
           
 void setAsciiName(java.lang.String asciiname)
           
 void setCountryCode(java.lang.String countryCode)
           
 void setElevation(java.lang.Integer elevation)
           
 void setFeatureClass(java.lang.String featureClass)
           
 void setFeatureCode(java.lang.String featureCode)
           
 void setFeatureId(java.lang.Long featureId)
          A featureId is unique and mandatory
 void setGtopo30(java.lang.Integer gtopo30)
           
 void setId(java.lang.Long id)
           
 void setLocation(com.vividsolutions.jts.geom.Point location)
           
 void setModificationDate(java.util.Date modificationDate)
           
 void setName(java.lang.String name)
           
 void setPopulation(java.lang.Integer population)
           
 void setSource(GISSource source)
           
 void setTimezone(java.lang.String timezone)
           
 void setZipCodes(java.util.List<ZipCode> zipCodes)
          Set The zipCodes for the city.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

countryDao

public ICountryDao countryDao

LOCATION_COLUMN_NAME

public static final java.lang.String LOCATION_COLUMN_NAME
See Also:
Constant Field Values

logger

protected static final org.slf4j.Logger logger
Constructor Detail

GisFeature

public GisFeature()
Default Constructor, needed by cgLib


GisFeature

public GisFeature(GisFeature gisFeature)
Copy Constructor that populate the current GisFeature with the specified gisFeature fields

Parameters:
gisFeature - The gisFeature from which we want to populate the GisFeature
Method Detail

getId

public java.lang.Long getId()
The datastore id

Returns:
The datastoreId, it is not a domain value, just a technical One

getCountry

public Country getCountry()
Returns:
the country from the country code. Return null if the country Code is null or if no country is found
See Also:
getCountryCode()

getLatitude

public java.lang.Double getLatitude()
Returns:
Returns the latitude (north-south) from the Location getLocation().
See Also:
getLongitude(), getLocation()

distanceTo

public double distanceTo(com.vividsolutions.jts.geom.Point point)
Calculate the distance from the current GisFeature to the specified point.

Parameters:
point - the JTS point we want to calculate the distance from
Returns:
the calculated distance
See Also:
GeolocHelper.distance(Point, Point)

getLocation

public com.vividsolutions.jts.geom.Point getLocation()
Returns The JTS location point of the current GisFeature : The Geometry representation of the latitude, longitude. The Return type is a JTS point. The Location is calculate from the 4326 SRID

Returns:
The JTS Point
See Also:
SRID, getLongitude(), getLocation()

getLongitude

public java.lang.Double getLongitude()
Returns:
Returns the longitude (east-west) from the Location getLocation().
See Also:
getLongitude(), getLocation()

getModificationDate

public java.util.Date getModificationDate()
The modification date of the feature. The date must match the Constants.GIS_DATE_PATTERN This fields is not updated when saving or updating a GisFeature. This fields is to track changes in the gazetteers, not in the Datastore.

Returns:
The modification date of the feature

getAdm1Code

public java.lang.String getAdm1Code()
Returns the Adm1Code for this feature. The only goal to have the Adm1Code directly in the GisFeature is for performance reasons :
It allows to have the adm1Code without loading all the Adm tree. See Important Notes for admXcode for GisFeature

Returns:
The Adm1Code for this Feature

setAdm1Code

public void setAdm1Code(java.lang.String adm1Code)
Parameters:
adm1Code - The adm1code to set
See Also:
getAdm1Code()

getAdm2Code

public java.lang.String getAdm2Code()
Returns the Adm2Code for this feature. The only goal to have the Adm2Code directly in the GisFeature is for performance reasons :
It allows to have the adm2Code without loading all the Adm tree. See Important Notes for admXcode for GisFeature

Returns:
The Adm2Code for this Feature

setAdm2Code

public void setAdm2Code(java.lang.String adm2Code)
Parameters:
adm2Code - the adm2code to set
See Also:
getAdm2Code()

getAdm3Code

public java.lang.String getAdm3Code()
Returns the Adm3Code for this feature. The only goal to have the Adm3Code directly in the GisFeature is for performance reasons :
It allows to have the adm3Code without loading all the Adm tree. See Important Notes for admXcode for GisFeature

Returns:
The Adm3Code for this Feature

setAdm3Code

public void setAdm3Code(java.lang.String adm3Code)
Parameters:
adm3Code - the adm3code to set
See Also:
getAdm3Code()

getAdm4Code

public java.lang.String getAdm4Code()
Returns the Adm4Code for this feature. The only goal to have the Adm4Code directly in the GisFeature is for performance reasons :
It allows to have the adm4Code without loading the all Adm tree. See Important Notes for admXcode for GisFeature

Returns:
The Adm4Code for this Feature

setAdm4Code

public void setAdm4Code(java.lang.String adm4Code)
Parameters:
adm4Code - the adm4code to set
See Also:
getAdm4Code()

getAdm1Name

public java.lang.String getAdm1Name()
Returns the name of the Adm of level 1 that this GisFeature is linked to. The only goal to have it directly in the gisFeature is for performance reasons :
It allows to have it without loading all the Adm tree

Returns:
The name of the Adm of level 1 that this GisFeature is linked to

setAdm1Name

public void setAdm1Name(java.lang.String adm1Name)
Set the name of the Adm of level 1 that this GisFeature is linked to

Parameters:
adm1Name - The name of the Adm of level 1 that this GisFeature is linked to
See Also:
getAdm1Name()

getAdm2Name

public java.lang.String getAdm2Name()
Returns the name of the Adm of level 2 that this GisFeature is linked to. The only goal to have it directly in the gisFeature is for performance reasons :
it allow to retrieve it without loading all the Adm tree

Returns:
The name of the Adm of level 2 that this GisFeature is linked to

setAdm2Name

public void setAdm2Name(java.lang.String adm2Name)
Set the name of the Adm of level 2 that this GisFeature is linked to

Parameters:
adm2Name - The name of the Adm of level 2 that this GisFeature is linked to
See Also:
getAdm2Name()

getAdm3Name

public java.lang.String getAdm3Name()
Returns the name of the Adm of level 3 that this GisFeature is linked to. The only goal to have it directly in the gisFeature is for performance reasons :
It allows to have it without loading all the Adm tree

Returns:
The name of the Adm of level 3 that this GisFeature is linked to

setAdm3Name

public void setAdm3Name(java.lang.String adm3Name)
Set the name of the Adm of level 3 that this GisFeature is linked to

Parameters:
adm3Name - The name of the Adm of level 3 that this GisFeature is linked to
See Also:
getAdm3Name()

getAdm4Name

public java.lang.String getAdm4Name()
Returns the name of the Adm of level 4 that this GisFeature is linked to. The only goal to have it directly in the gisFeature is for performance reasons :
It allows to have it without loading all the Adm tree

Returns:
The name of the Adm of level 4 that this GisFeature is linked to

setAdm4Name

public void setAdm4Name(java.lang.String adm4Name)
Set The name of the adm of level 4 that the GisFeature is linked to

Parameters:
adm4Name - The name of the adm of level 4 that the GisFeature is linked to
See Also:
getAdm4Name()

getAdm

public Adm getAdm()
Returns:
The Adm with the higher Level that this GisFeature is linked to (the deeper in the Adm tree). See Important Notes for admXcode for GisFeature

setAdm

public void setAdm(Adm adm)
Parameters:
adm - The Adm with the higher Level that this GisFeature is linked to (the deeper in the Adm tree).
See Also:
getAdm()

getAlternateNames

public java.util.List<AlternateName> getAlternateNames()
Returns:
A list of the AlternateNames for this GisFeature

setAlternateNames

public void setAlternateNames(java.util.List<AlternateName> alternateNames)
Parameters:
alternateNames - The AlternateNames for this GisFeature

addAlternateName

public void addAlternateName(AlternateName alternateName)
Do a double set : add the alternate name to the current GisFeature and set this GisFeature as the GisFeature of the specified AlternateName

Parameters:
alternateName - the alternateName to add

addAlternateNames

public void addAlternateNames(java.util.List<AlternateName> alternateNames)
Do a double set : add (not replace !) the AlternateNames to the current GisFeature and for each alternatenames : set the current GisFeature as the GisFeature of the Alternate Names

Parameters:
alternateNames - The alternateNames list to add

getAsciiName

public java.lang.String getAsciiName()
Returns:
The ASCII name of the current GisFeature

setAsciiName

public void setAsciiName(java.lang.String asciiname)
Parameters:
asciiname - The ASCII name of the current GisFeature
See Also:
getAsciiName()

getCountryCode

public java.lang.String getCountryCode()
The country code is not mandatory because gisfeature like undersea does not belongs to a country

Returns:
The ISO 3166 alpha-2 letter code.

setCountryCode

public void setCountryCode(java.lang.String countryCode)
Parameters:
countryCode - The ISO 3166 alpha-2 letter code in upper Case (it will be automatically uppercased)
See Also:
getCountryCode()

getElevation

public java.lang.Integer getElevation()
Returns:
The elevation of this gisFeature (in meters)

setElevation

public void setElevation(java.lang.Integer elevation)
Parameters:
elevation - The elevation of this gisFeature (in meters)
See Also:
getElevation()

getGtopo30

public java.lang.Integer getGtopo30()
Returns:
The average elevation of 30'x30' (900mx900m) area in meters

setGtopo30

public void setGtopo30(java.lang.Integer gtopo30)
Parameters:
gtopo30 - The average elevation of 30'x30' (900mx900m) area to set in meters

getName

public java.lang.String getName()
Returns:
The UTF-8 name for the current GisFeature

setName

public void setName(java.lang.String name)
Parameters:
name - The UTF-8 name for the current GisFeature

getPopulation

public java.lang.Integer getPopulation()
Returns:
The population (how many people are in) for this GisFeature

setPopulation

public void setPopulation(java.lang.Integer population)
Parameters:
population - The population (how many people are in) of this GisFeature

getSource

public GISSource getSource()
Returns:
The source for the gisFeature. it tells from which files / gazetteers it has been imported

setSource

public void setSource(GISSource source)
Parameters:
source - The source for the gisFeature to be set

getTimezone

public java.lang.String getTimezone()
Returns:
The timeZone for This GisFeature
See Also:
Time zone

setTimezone

public void setTimezone(java.lang.String timezone)
Parameters:
timezone - The timeZone for This GisFeature
See Also:
getTimezone()

setLocation

public void setLocation(com.vividsolutions.jts.geom.Point location)
Parameters:
location - The location of the GisFeature (JTS point)
See Also:
getLocation(), getLatitude(), getLongitude()

setModificationDate

public void setModificationDate(java.util.Date modificationDate)
Parameters:
modificationDate - The Date of the Last Modification. This fields is not updated when saving or updating a GisFeature : This fields is to track changes in the gazetteers, not in the datastore. The date should match the Constants.GIS_DATE_PATTERN
See Also:
getModificationDate()

setId

public void setId(java.lang.Long id)
Parameters:
id - The Id in the datastore. You should never call this method. It is the responsability of the dataStore
See Also:
getId()

getFeatureId

public java.lang.Long getFeatureId()
Returns:
The featureId for this GisFeature. it is a 'Domain value' not a datastore one. A featureId is unique and mandatory

setFeatureId

public void setFeatureId(java.lang.Long featureId)
A featureId is unique and mandatory

Parameters:
featureId - The featureId for this GisFeature

isCity

public boolean isCity()
Whether the feature is a city, in the sense we define it in the FeatureClassCodeHelper class. It does not check the Class but the feature class and the feature code

Returns:
true if it is a city

isCountry

public boolean isCountry()
Whether the feature is a coutry, in the sense we define it in the FeatureClassCodeHelper class. It does not check the Class but the feature class and the feature code

Returns:
true if it is a country

isAdm

public boolean isAdm()
Whether the feature is an Adm, in the sense we define it in the FeatureClassCodeHelper class. It does not check the Class but the feature class and the feature code

Returns:
true if it is an ADM

getFeatureClass

public java.lang.String getFeatureClass()
Returns:
The feature class for this gisFeature (should always be in uppercase because setter automatically convert the feature class in upperCase). A feature class regroup some feature code
See Also:
codes

setFeatureClass

public void setFeatureClass(java.lang.String featureClass)
Parameters:
featureClass - The feature class to set. Note The featureClass will automaticaly be uppercased.
See Also:
getFeatureClass()

getFeatureCode

public java.lang.String getFeatureCode()
Returns:
The featureCode for the current GisFeature. A feature code represents a specific feature type. GisGraphy regroup some feature codes in an abstract Level called 'place type'. A place type regroup several featurecode.
See Also:
FeatureCode

populate

public void populate(GisFeature gisFeature)
Populate all the field / association of the current gisFeature with The Value of The specified One.

Parameters:
gisFeature - the gisFeature to populate with

setFeatureCode

public void setFeatureCode(java.lang.String featureCode)
Parameters:
featureCode - The feature Code for this GisFeature Note The featureCode will automaticaly be uppercased
See Also:
getFeatureCode()

isFullTextSearchable

public boolean isFullTextSearchable()
Returns:
true If the gisFeature must be sync with the fullText search engine

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getFullyQualifiedName

public java.lang.String getFullyQualifiedName(boolean withCountry)
Returns a name of the form : (adm1Name et adm2Name are printed) Paris, Département de Ville-De-Paris, Ile-De-France, (FR)

Parameters:
withCountry - Whether the country information should be added
Returns:
a name with the Administrative division and Country

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
Returns:
a name with the Administrative division (but without Country) wrap getFullyQualifiedName(boolean)
See Also:
getFullyQualifiedName(boolean)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addZipCode

public void addZipCode(ZipCode zipCode)
Do a double set : add the zip code to the current GisFeature and set this GisFeature as the GisFeature of the zipcode

Parameters:
zipCode - the zip code to add

addZipCodes

public void addZipCodes(java.util.List<ZipCode> zipCodes)
Do a double set : add the zip codes to the current GisFeature and set this GisFeature as the GisFeature of the zipcodes * @param zipCodes the zip codes to add


getZipCodes

public java.util.List<ZipCode> getZipCodes()
Returns:
the zip codes for the city

setZipCodes

public void setZipCodes(java.util.List<ZipCode> zipCodes)
Set The zipCodes for the city. IMPORTANT : if you set the zipCodes, you should do a double set : that means that you should set the gisfeature property for all the zip codes, if you don't you will get problems when saving entity in the datastore. Please use this method you should prefer the methods addZipCode(ZipCode) and addZipCodes(List) that do it automatically.

Parameters:
zipCodes - The zip codes for the City


Copyright © 2010. All Rights Reserved.