Class GeoBase

java.lang.Object
org.opensextant.data.GeoBase
All Implemented Interfaces:
LatLon
Direct Known Subclasses:
Place

public class GeoBase extends Object implements LatLon
An intermediary between the simple LatLon and other conceptual classes: Place, Country, etc.
Author:
Marc C. Ubaldino, MITRE, ubaldino at mitre dot org
  • Field Details

    • key

      protected String key
      identifier ID
    • name

      public String name
      any name associated with this place
    • latitude

      protected double latitude
    • longitude

      protected double longitude
  • Constructor Details

    • GeoBase

      public GeoBase()
      Creates an empty GeoBase location object
    • GeoBase

      public GeoBase(String placeId, String nm)
      Creates a new instance of GeoBase
      Parameters:
      placeId - place Id
      nm - place name
    • GeoBase

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

    • getKey

      public String getKey()
      Returns:
      place id
    • setKey

      public void setKey(String k)
      legacy nomenclature. Place ID is better.
      Parameters:
      k - place Id
    • setName

      public final void setName(String nm)
      Parameters:
      nm - name for this location
    • getName

      public String getName()
      Returns:
      name of location
    • getNamenorm

      public String getNamenorm()
    • toString

      public String toString()
      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 Object
      Returns:
      string repr of the location
    • getLatitude

      public double getLatitude()
      Specified by:
      getLatitude in interface LatLon
      Returns:
      lat in degrees
    • setLatitude

      public void setLatitude(double lat)
      Specified by:
      setLatitude in interface LatLon
      Parameters:
      lat - in degrees
    • getLongitude

      public double getLongitude()
      Specified by:
      getLongitude in interface LatLon
      Returns:
      longitude in degrees
    • setLongitude

      public void setLongitude(double lon)
      Specified by:
      setLongitude in interface LatLon
      Parameters:
      lon - in degrees
    • setGeohash

      public void setGeohash(String gh)
      Set and get Geohash -- this is delegated to caller as core processing need not have a geohash generated when lat/lon is set.
      Parameters:
      gh - geohash
    • getGeohash

      public String getGeohash()
      Returns:
      geohash
    • setLatLon

      public void setLatLon(LatLon geo)
      Convenience method
      Parameters:
      geo - lat/lon pair
    • hasCoordinate

      public boolean hasCoordinate()
      Convenience method for checking if lat/lon was set to other than 0,0 (default)
      Returns:
      true if instance has non-zero coordinates.