Class Position

  • All Implemented Interfaces:
    java.io.Serializable

    public final class Position
    extends EField
    A position is the fundamental geometry construct. The "coordinates" member of a Geometry object is composed of either:
    • one position in the case of a Point geometry,
    • an array of positions in the case of a LineString or MultiPoint geometry,
    • an array of LineString or linear ring coordinates in the case of a Polygon or MultiLineString geometry, or
    • an array of Polygon coordinates in the case of a MultiPolygon geometry.
    A position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation may be included as an optional third element.

    Implementations should not extend positions beyond three elements because the semantics of extra elements are unspecified and ambiguous. Historically, some implementations have used a fourth element to carry a linear referencing measure (sometimes denoted as "M") or a numerical timestamp, but in most situations a parser will not be able to properly interpret these values. The interpretation and meaning of additional elements is beyond the scope of this specification, and additional elements may be ignored by parsers.

    Author:
    Charles W. Rapp
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Position.Builder
      Position instances may be created only by using a Builder instance.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.math.BigDecimal elevation
      Elevation is an optional third parameter and may be set to null.
      java.math.BigDecimal latitude
      Latitude coordinate in degrees (North of equator is positive) using the standard WGS84 projection.
      java.math.BigDecimal longitude
      Longitude coordinate in degrees (East of Greenwich is positive) using the standard WGS84 projection.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Position.Builder builder()
      Returns a new GeoJSON position builder instance.
      boolean equals​(java.lang.Object o)
      Returns true if either o is the same Position instance as this or is a non-null Position instance with the same latitude and longitude as this Position.
      int hashCode()
      Returns a hash of the latitude and longitude.
      java.lang.String toString()
      Returns human-readable text containing the position latitude and longitude.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • latitude

        public final java.math.BigDecimal latitude
        Latitude coordinate in degrees (North of equator is positive) using the standard WGS84 projection. Some applications may not accept latitudes above/below ±85 degrees for some projections.
      • longitude

        public final java.math.BigDecimal longitude
        Longitude coordinate in degrees (East of Greenwich is positive) using the standard WGS84 projection. Note that geographic poles will be exactly at latitude ±90 degrees but in that case the longitude will be set to an arbitrary value within this range.
      • elevation

        @Nullable
        public final java.math.BigDecimal elevation
        Elevation is an optional third parameter and may be set to null.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Returns true if either o is the same Position instance as this or is a non-null Position instance with the same latitude and longitude as this Position.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - comparison object.
        Returns:
        if o is a non-null Position instance with the same latitude and longitude as this Position.
      • hashCode

        public int hashCode()
        Returns a hash of the latitude and longitude.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hash of the GeoJSON position.
      • toString

        public java.lang.String toString()
        Returns human-readable text containing the position latitude and longitude.
        Overrides:
        toString in class java.lang.Object
        Returns:
        GeoJSON position as human-readable text.