Package pygeodesy :: Module geohash :: Class Geohash
[frames] | no frames]

Class Geohash

  object --+            
           |            
  basestring --+        
               |        
             str --+    
                   |    
  object --+       |    
           |       |    
named._Named --+   |    
               |   |    
units._NamedUnit --+    
                   |    
           units.Str --+
                       |
                      Geohash

Geohash class, a named str.

Instance Methods
 
adjacent(self, direction, name='')
Determine the adjacent cell in given compass direction.
 
bounds(self, LatLon=None, **LatLon_kwds)
Return the lower-left SW and upper-right NE bounds of this geohash cell.
 
distanceTo(self, other)
Estimate the distance between this and an other geohash based the cell sizes.
 
distance1To(self, other)
Estimate the distance between this and an other geohash based the cell sizes.
 
distance1(self, other)
Estimate the distance between this and an other geohash based the cell sizes.
 
equirectangularTo(self, other, radius=6371008.77141, adjust=False, wrap=False)
Approximate the distance between this and an other geohash using the equirectangular function.
 
distance2To(self, other, radius=6371008.77141, adjust=False, wrap=False)
Approximate the distance between this and an other geohash using the equirectangular function.
 
distance2(self, other, radius=6371008.77141, adjust=False, wrap=False)
Approximate the distance between this and an other geohash using the equirectangular function.
 
euclideanTo(self, other, radius=6371008.77141, adjust=False, wrap=False)
Approximate the distance between this and an other geohash using the euclidean function.
 
haversineTo(self, other, radius=6371008.77141, wrap=False)
Compute the distance between this and an other geohash using the haversine formula.
 
distance3To(self, other, radius=6371008.77141, wrap=False)
Compute the distance between this and an other geohash using the haversine formula.
 
distance3(self, other, radius=6371008.77141, wrap=False)
Compute the distance between this and an other geohash using the haversine formula.
 
toLatLon(self, LatLon=None, **LatLon_kwds)
Return (the approximate center of) this geohash cell as an instance of the supplied LatLon class.
 
vincentysTo(self, other, radius=6371008.77141, wrap=False)
Compute the distance between this and an other geohash using the vincentys formula.

Inherited from units.Str: __repr__, __str__, toRepr, toStr

Inherited from str: __add__, __contains__, __eq__, __format__, __ge__, __getattribute__, __getitem__, __getnewargs__, __getslice__, __gt__, __hash__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __rmod__, __rmul__, __sizeof__, capitalize, center, count, decode, encode, endswith, expandtabs, find, format, index, isalnum, isalpha, isdigit, islower, isspace, istitle, isupper, join, ljust, lower, lstrip, partition, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill

Inherited from named._Named: _DOT_, attrs, classof, copy, rename, toStr2

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Static Methods
a new object with type S, a subtype of T
__new__(cls, cll, precision=None, name='')
New Geohash from an other Geohash instance or str or from a LatLon instance or str.
Properties
  latlon
Get the lat- and longitude of (the approximate center of) this geohash as a LatLon2Tuple(lat, lon) in degrees.
  neighbors
Get all 8 adjacent cells as a Neighbors8Dict(N, NE, E, SE, S, SW, W, NW) of Geohashes.
  philam
Get the lat- and longitude of (the approximate center of) this geohash as a PhiLam2Tuple(phi, lam) in radians.
  ab
DEPRECATED, use property philam.
  precision
Get this geohash's precision (int).
  sizes
Get the lat- and longitudinal size of this cell as a LatLon2Tuple(lat, lon) in (meter).
  N
Get the cell North of this (Geohash).
  S
Get the cell South of this (Geohash).
  E
Get the cell East of this (Geohash).
  W
Get the cell West of this (Geohash).
  NE
Get the cell NorthEast of this (Geohash).
  NW
Get the cell NorthWest of this (Geohash).
  SE
Get the cell SouthEast of this (Geohash).
  SW
Get the cell SouthWest of this (Geohash).

Inherited from units._NamedUnit: std_repr, units

Inherited from named._Named: classname, classnaming, name, named, named2, named3, named4

Inherited from object: __class__

Method Details

__new__ (cls, cll, precision=None, name='')
Static Method

 

New Geohash from an other Geohash instance or str or from a LatLon instance or str.

Arguments:
  • cll - Cell or location (Geohash, LatLon or str).
  • precision - Optional, the desired geohash length (int 1..12), see function geohash.encode for some examples.
  • name - Optional name (str).
Returns: a new object with type S, a subtype of T
New Geohash.
Raises:
  • GeohashError - INValid or non-alphanumeric cll.
  • TypeError - Invalid cll.
Overrides: object.__new__

adjacent (self, direction, name='')

 

Determine the adjacent cell in given compass direction.

Arguments:
  • direction - Compass direction ('N', 'S', 'E' or 'W').
  • name - Optional name (str), otherwise the name of this cell plus .Direction.
Returns:
Geohash of adjacent cell (Geohash).
Raises:

bounds (self, LatLon=None, **LatLon_kwds)

 

Return the lower-left SW and upper-right NE bounds of this geohash cell.

Arguments:
  • LatLon - Optional class to return bounds (LatLon) or None.
  • LatLon_kwds - Optional keyword arguments for {LatLon}.
Returns:
A Bounds2Tuple(latlonSW, latlonNE) of LatLons or if LatLon is None, a Bounds4Tuple(latS, lonW, latN, lonE).

distanceTo (self, other)

 

Estimate the distance between this and an other geohash based the cell sizes.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
Returns:
Approximate distance (meter).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str.

distance1To (self, other)

 

Estimate the distance between this and an other geohash based the cell sizes.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
Returns:
Approximate distance (meter).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str.

distance1 (self, other)

 

Estimate the distance between this and an other geohash based the cell sizes.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
Returns:
Approximate distance (meter).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str.

equirectangularTo (self, other, radius=6371008.77141, adjust=False, wrap=False)

 

Approximate the distance between this and an other geohash using the equirectangular function.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
  • radius - Mean earth radius, ellipsoid or datum (meter, Ellipsoid, Ellipsoid2, Datum or a_f2Tuple) or None.
  • adjust - Adjust the wrapped, unrolled longitudinal delta by the cosine of the mean latitude bool).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes or radians squared if radius is None or 0).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

See Also: Local, flat earth approximation, functions

distance2To (self, other, radius=6371008.77141, adjust=False, wrap=False)

 

Approximate the distance between this and an other geohash using the equirectangular function.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
  • radius - Mean earth radius, ellipsoid or datum (meter, Ellipsoid, Ellipsoid2, Datum or a_f2Tuple) or None.
  • adjust - Adjust the wrapped, unrolled longitudinal delta by the cosine of the mean latitude bool).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes or radians squared if radius is None or 0).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

See Also: Local, flat earth approximation, functions

distance2 (self, other, radius=6371008.77141, adjust=False, wrap=False)

 

Approximate the distance between this and an other geohash using the equirectangular function.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
  • radius - Mean earth radius, ellipsoid or datum (meter, Ellipsoid, Ellipsoid2, Datum or a_f2Tuple) or None.
  • adjust - Adjust the wrapped, unrolled longitudinal delta by the cosine of the mean latitude bool).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes or radians squared if radius is None or 0).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

See Also: Local, flat earth approximation, functions

euclideanTo (self, other, radius=6371008.77141, adjust=False, wrap=False)

 

Approximate the distance between this and an other geohash using the euclidean function.

Arguments:
  • other - The other geohash (Geohash, LatLon or str).
  • radius - Mean earth radius, ellipsoid or datum (meter, Ellipsoid, Ellipsoid2, Datum or a_f2Tuple).
  • adjust - Adjust the wrapped, unrolled longitudinal delta by the cosine of the mean latitude bool).
  • wrap - Wrap and unroll longitudes (bool).
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

haversineTo (self, other, radius=6371008.77141, wrap=False)

 

Compute the distance between this and an other geohash using the haversine formula.

Arguments:
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

distance3To (self, other, radius=6371008.77141, wrap=False)

 

Compute the distance between this and an other geohash using the haversine formula.

Arguments:
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

distance3 (self, other, radius=6371008.77141, wrap=False)

 

Compute the distance between this and an other geohash using the haversine formula.

Arguments:
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

toLatLon (self, LatLon=None, **LatLon_kwds)

 

Return (the approximate center of) this geohash cell as an instance of the supplied LatLon class.

Arguments:
  • LatLon - Class to use (LatLon) or None.
  • LatLon_kwds - Optional, additional LatLon keyword arguments, ignored if LatLon=None.
Returns:
This geohash location (LatLon) or a LatLon2Tuple(lat, lon) if LatLon is None.
Raises:
  • TypeError - Invalid LatLon or LatLon_kwds.

Example:

>>> from sphericalTrigonometry import LatLon
>>> ll = Geohash('u120fxw').toLatLon(LatLon)
>>> print(repr(ll))  # LatLon(52°12′17.9″N, 000°07′07.64″E)
>>> print(ll)  # 52.204971°N, 000.11879°E

vincentysTo (self, other, radius=6371008.77141, wrap=False)

 

Compute the distance between this and an other geohash using the vincentys formula.

Arguments:
Returns:
Distance (meter, same units as radius or the ellipsoid or datum axes).
Raises:
  • TypeError - The other is not a Geohash, LatLon or str or invalid radius.

Property Details

latlon

Get the lat- and longitude of (the approximate center of) this geohash as a LatLon2Tuple(lat, lon) in degrees.

Example:

>>> geohash.Geohash('geek').latlon  # 65.478515625, -17.75390625
>>> geohash.decode('geek')  # '65.48', '-17.75'
Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

neighbors

Get all 8 adjacent cells as a Neighbors8Dict(N, NE, E, SE, S, SW, W, NW) of Geohashes.

JSname: neighbours.

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

philam

Get the lat- and longitude of (the approximate center of) this geohash as a PhiLam2Tuple(phi, lam) in radians.

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

ab

DEPRECATED, use property philam.

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

precision

Get this geohash's precision (int).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

sizes

Get the lat- and longitudinal size of this cell as a LatLon2Tuple(lat, lon) in (meter).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

N

Get the cell North of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

S

Get the cell South of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

E

Get the cell East of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

W

Get the cell West of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

NE

Get the cell NorthEast of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

NW

Get the cell NorthWest of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

SE

Get the cell SouthEast of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)

SW

Get the cell SouthWest of this (Geohash).

Get method:
_fget(inst)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst)