public class GeoHashCoder extends Object implements Serializable
Defined in the sis-storage module
Modifier and Type | Class and Description |
---|---|
static class |
GeoHashCoder.Format
The encoding format used by
GeoHashCoder . |
Constructor and Description |
---|
GeoHashCoder()
Creates a new geohash coder/decoder initialized to the default precision for
GeoHashCoder.Format.BASE32 . |
Modifier and Type | Method and Description |
---|---|
DirectPosition |
decode(String geohash)
Decodes the given geohash into a longitude and a latitude.
|
String |
encode(DirectPosition position)
Encodes the given position into a geohash.
|
String |
encode(double longitude,
double latitude)
Encodes the given longitude and latitude into a geohash.
|
GeoHashCoder.Format |
getFormat()
Returns the current encoding/decoding format.
|
int |
getPrecision()
Returns the length of geohashes strings to be encoded by the
encode(DirectPosition) method. |
void |
setFormat(GeoHashCoder.Format format)
Sets the encoding/decoding format.
|
void |
setPrecision(int precision)
Sets the length of geohashes strings to be encoded by the
encode(DirectPosition) method. |
public GeoHashCoder()
GeoHashCoder.Format.BASE32
.public GeoHashCoder.Format getFormat()
GeoHashCoder.Format.BASE32
.public void setFormat(GeoHashCoder.Format format)
format
- The new format.public int getPrecision()
encode(DirectPosition)
method.
The default value is 12.public void setPrecision(int precision)
encode(DirectPosition)
method.precision
- The new length of geohashes strings.public String encode(double longitude, double latitude)
longitude
- Longitude to encode, as decimal degrees in the [-180 … 180]° range.latitude
- Latitude to encode, as decimal degrees in the [-90 … 90]° range.public String encode(DirectPosition position)
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.
position
- The coordinate to encode.public DirectPosition decode(String geohash) throws ParseException
geohash
- Geohash string to decode.ParseException
- If an error occurred while parsing the given string.Copyright © 2010–2013 The Apache Software Foundation. All rights reserved.