Class Place

  • All Implemented Interfaces:
    Geocoding, LatLon
    Direct Known Subclasses:

    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.
    Marc C. Ubaldino, MITRE, ubaldino at mitre dot org, David P. Lutz, MITRE, dlutz at mitre dot org
    • 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
    • Constructor Detail

      • Place

        public Place​(java.lang.String placeId,
                     java.lang.String nm)
        Creates a new instance of GeoBase
        placeId - primary key or ID for this place
        nm - place name
      • Place

        public Place()
      • Place

        public Place​(double lat,
                     double lon)
    • Method Detail

      • copyTo

        public void copyTo​(Place p)
        Copy the basic gazetteer metadata to
        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"
      • isShortName

        public boolean isShortName()
        Alias for "isAbbreviation() || isCode()"
      • 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 interface Geocoding
        c - Country object which contains or is associated with this Place.
      • getCountry

        public Country getCountry()
        get the country object; generally optional.
        the country object.
      • setCountryCode

        public void setCountryCode​(java.lang.String cc)
        Compat: set country_id aka CountryCode
        Specified by:
        setCountryCode in interface Geocoding
        cc - a country code. Caller's choice as far as code code standard used.
      • setFeatureClass

        public void setFeatureClass​(java.lang.String cls)
      • 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.
        otherGeo -
      • setPlaceID

        public final void setPlaceID​(java.lang.String id)
        Wrapper around GeoBase.setKey for compat
        id - place identity
      • getPlaceID

        public java.lang.String getPlaceID()
        Specified by:
        getPlaceID in interface Geocoding
      • setPlaceName

        public final void setPlaceName​(java.lang.String nm)
        Specified by:
        setPlaceName in interface Geocoding
      • getNDNamenorm

        public java.lang.String getNDNamenorm()
        Returns a pre-computed Non-diacritic name
      • getPlaceName

        public final java.lang.String getPlaceName()
        Specified by:
        getPlaceName in interface Geocoding
      • getAdmin1

        public java.lang.String getAdmin1()
        Specified by:
        getAdmin1 in interface Geocoding
      • setAdmin1

        public void setAdmin1​(java.lang.String key)
      • getAdmin2

        public java.lang.String getAdmin2()
        Specified by:
        getAdmin2 in interface Geocoding
      • setAdmin2

        public void setAdmin2​(java.lang.String key)
      • getSource

        public java.lang.String getSource()
        Get the original source of this information.
        source gazetteer
      • setSource

        public void setSource​(java.lang.String src)
      • isAbbreviation

        public boolean isAbbreviation()
        true if name value here is an abbreviation, e.g., Mass.
      • isCode

        public boolean isCode()
      • isCountry

        public boolean isCountry()
        Is this Place a Country?
        Specified by:
        isCountry in interface Geocoding
        true if this is a country or "country-like" place
      • isPlace

        public boolean isPlace()
        Specified by:
        isPlace in interface Geocoding
        true if geocoding represents a named place
      • isCoordinate

        public boolean isCoordinate()
        Description copied from interface: Geocoding
        isCoordinate: if this object represents a coordinate
        Specified by:
        isCoordinate in interface Geocoding
        true if geocoding represents a coordinate
      • 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.
        true if feature class is typically populated
      • isAdmin1

        public boolean isAdmin1()
        Is this Place a State or Province?
        - true if this is a State, Province or other first level admin area
      • isNationalCapital

        public boolean isNationalCapital()
        Is this Place a National Capital?
        - 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.
        name bias
      • setName_bias

        public void setName_bias​(int bias)
        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.
        identity bias
      • setId_bias

        public void setId_bias​(int bias)
        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
        toString in class GeoBase
        string repr of the location
      • 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.
        other - another Place
        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 interface Geocoding
        prec - , meters of error
      • getPrecision

        public int getPrecision()
        Get the relative precision of this feature; in meters of error
        Specified by:
        getPrecision in interface Geocoding
        precision, meters of error.
        See Also:
      • setMethod

        public void setMethod​(java.lang.String m)
        Specified by:
        setMethod in interface Geocoding
      • 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.
        Specified by:
        getMethod in interface Geocoding
        method of geocoding;
      • getAdminName

        public java.lang.String getAdminName()
        Specified by:
        getAdminName in interface Geocoding
      • setAdminName

        public void setAdminName​(java.lang.String admName)
        admName - name of the administrative boundary that contains this place.
      • getAdmin1Name

        public java.lang.String getAdmin1Name()
        Specified by:
        getAdmin1Name in interface Geocoding
      • getAdmin2Name

        public java.lang.String getAdmin2Name()
        Specified by:
        getAdmin2Name in interface Geocoding
      • 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:
         "" (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 interface Geocoding
        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 interface Geocoding
        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 interface Geocoding
        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 interface Geocoding
        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.
        id -
      • getInstanceId

        public java.lang.String getInstanceId()