Class Place

All Implemented Interfaces:
Geocoding, LatLon
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 Details

    • admin1

      protected 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 String admin2
    • name_type

      protected char name_type
    • country

      protected Country country
    • country_id

      protected String country_id
    • adminName

      protected String adminName
    • admin1Name

      protected String admin1Name
    • admin2Name

      protected String admin2Name
    • method

      protected String method
  • Constructor Details

    • Place

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

      public Place()
    • Place

      public Place(double lat, double lon)
  • Method Details

    • 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 interface Geocoding
      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(String cc)
      Compat: set country_id aka CountryCode
      Specified by:
      setCountryCode in interface Geocoding
      Parameters:
      cc - a country code. Caller's choice as far as code code standard used.
    • getCountryCode

      public String getCountryCode()
      Specified by:
      getCountryCode in interface Geocoding
    • getFeatureClass

      public String getFeatureClass()
      Specified by:
      getFeatureClass in interface Geocoding
    • setFeatureClass

      public void setFeatureClass(String cls)
    • getFeatureCode

      public String getFeatureCode()
      Specified by:
      getFeatureCode in interface Geocoding
    • setFeatureCode

      public void setFeatureCode(String featCode)
    • getFeatureDesignation

      public 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(String id)
      Wrapper around GeoBase.setKey for compat
      Parameters:
      id - place identity
    • getPlaceID

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

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

      public String getNDNamenorm()
      Returns a pre-computed Non-diacritic name
      Returns:
    • getPlaceName

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

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

      public void setAdmin1(String key)
    • getAdmin2

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

      public void setAdmin2(String key)
    • getSource

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

      public void setSource(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?
      Specified by:
      isCountry in interface Geocoding
      Returns:
      true if this is a country or "country-like" place
    • isPlace

      public boolean isPlace()
      Specified by:
      isPlace in interface Geocoding
      Returns:
      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
      Returns:
      true if geocoding represents a coordinate
    • isAdministrative

      public boolean isAdministrative()
      Specified by:
      isAdministrative in interface Geocoding
    • isPostal

      public boolean isPostal()
      Determines if this feature instance is a postal zone, coded "A/POST"
    • 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 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
      Overrides:
      toString in class GeoBase
      Returns:
      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.
      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 interface Geocoding
      Parameters:
      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
      Returns:
      precision, meters of error.
      See Also:
    • setMethod

      public void setMethod(String m)
      Specified by:
      setMethod in interface Geocoding
    • getMethod

      public 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
      Returns:
      method of geocoding;
    • getAdminName

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

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

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

      public String getAdmin2Name()
      Specified by:
      getAdmin2Name in interface Geocoding
    • setAdmin1Name

      public void setAdmin1Name(String n)
    • setAdmin2Name

      public void setAdmin2Name(String n)
    • getHierarchicalPath

      public String getHierarchicalPath()
      This ensures at least a default hierarchichal path is set.
    • setHierarchicalPath

      public void setHierarchicalPath(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 String getAdmin1PostalCode()
      State-level postal code, the corresponds usually to ADM1
      Specified by:
      getAdmin1PostalCode in interface Geocoding
      Returns:
      optional postal code
    • getPlacePostalCode

      public 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
      Returns:
      optional postal code
    • setAdmin1PostalCode

      public void setAdmin1PostalCode(String c)
    • setPlacePostalCode

      public void setPlacePostalCode(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
      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 interface Geocoding
      Parameters:
      c - confidence
    • setInstanceId

      public void setInstanceId(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 String getInstanceId()
      Returns: