org.apache.sis.index

## Class GeoHashCoder

- Object
- - GeoHashCoder

- All Implemented Interfaces:
    Serializable

  Deprecated.
  Moved to `GeohashReferenceSystem`. Note that axis order of `encode(double, double)` method differs.

      @Deprecated
      public class GeoHashCoder
      extends Object
      implements Serializable

  Encodes geographic coordinates as geohashes strings, and decode such strings back to coordinates. The current implementation is restricted to two-dimensional geographic coordinates, in the (longitude, latitude) order with the longitudes ranging from -180° to 180° and the latitudes ranging from -90° to 90°. The datum is unspecified.
  Since:
    0.1
  See Also:
    Wikipedia: Geohash, Serialized Form

  Defined in the `sis-storage` module

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GeoHashCoder.Format` Deprecated. Moved to `GeohashReferenceSystem​.Format`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeoHashCoder()` Deprecated. Creates a new geohash coder/decoder initialized to the default precision for `GeoHashCoder​.Format​.BASE32`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `DirectPosition` | `decode(String geohash)` Deprecated. Decodes the given geohash into a longitude and a latitude.
    `String` | `encode(DirectPosition position)` Deprecated. Encodes the given position into a geohash.
    `String` | `encode(double longitude, double latitude)` Deprecated. Encodes the given longitude and latitude into a geohash.
    `GeoHashCoder.Format` | `getFormat()` Deprecated. Returns the current encoding/decoding format.
    `int` | `getPrecision()` Deprecated. Returns the length of geohashes strings to be encoded by the `encode(DirectPosition)` method.
    `void` | `setFormat(GeoHashCoder.Format format)` Deprecated. Sets the encoding/decoding format.
    `void` | `setPrecision(int precision)` Deprecated. Sets the length of geohashes strings to be encoded by the `encode(DirectPosition)` method.

    - ### Methods inherited from class Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GeoHashCoder

          public GeoHashCoder()

      Deprecated.
      Creates a new geohash coder/decoder initialized to the default precision for `GeoHashCoder​.Format​.BASE32`.

  - ### Method Detail

    - #### getFormat

          public GeoHashCoder.Format getFormat()

      Deprecated.
      Returns the current encoding/decoding format. The default value is `GeoHashCoder​.Format​.BASE32`.
      Returns:
        the current format.

    - #### setFormat

          public void setFormat(GeoHashCoder.Format format)

      Deprecated.
      Sets the encoding/decoding format.
      Parameters:
        `format` - the new format.

    - #### getPrecision

          public int getPrecision()

      Deprecated.
      Returns the length of geohashes strings to be encoded by the `encode(DirectPosition)` method. The default value is 12.
      Returns:
        the length of geohashes strings.

    - #### setPrecision

          public void setPrecision(int precision)

      Deprecated.
      Sets the length of geohashes strings to be encoded by the `encode(DirectPosition)` method.
      Parameters:
        `precision` - the new length of geohashes strings.

    - #### encode

          public String encode(double longitude,
                               double latitude)

      Deprecated.
      Encodes the given longitude and latitude into a geohash.
      Parameters:
        `longitude` - longitude to encode, as decimal degrees in the [-180 … 180]° range.
        `latitude` - latitude to encode, as decimal degrees in the [-90 … 90]° range.
      Returns:
        Geohash encoding of the given longitude and latitude.

    - #### encode

          public String encode(DirectPosition position)

      Deprecated.
      Encodes the given position into a geohash. The current implementation takes the first ordinate value as the longitude, the second ordinate value as the latitude, then delegates to `encode(double, double)`.

      The current implementation does not verify the Coordinate Reference System of the given position. However this may change in future SIS versions.

      Parameters:
        `position` - the coordinate to encode.
      Returns:
        Geohash encoding of the given position.

    - #### decode

          public DirectPosition decode(String geohash)
                                throws ParseException

      Deprecated.
      Decodes the given geohash into a longitude and a latitude.
      Parameters:
        `geohash` - geohash string to decode.
      Returns:
        a new position with the longitude at ordinate 0 and latitude at ordinate 1.
      Throws:
        `ParseException` - if an error occurred while parsing the given string.

Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.