pygeodesy.geohash.Geohash

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

# Class Geohash

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

Geohash class, a named `str`.

Instance Methods
adjacent(self, direction, **name) Determine the adjacent cell in the 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) DEPRECATED, use method distanceTo. |
distance1(self, other) DEPRECATED, use method distanceTo. |
distance2To(self, other, radius=6371008.771415, adjust=False, wrap=False) DEPRECATED, use method equirectangularTo. |
distance2(self, other, radius=6371008.771415, adjust=False, wrap=False) DEPRECATED, use method equirectangularTo. |
distance3To(self, other, radius=6371008.771415, wrap=False) DEPRECATED, use method haversineTo. |
distance3(self, other, radius=6371008.771415, wrap=False) DEPRECATED, use method haversineTo. |
equirectangularTo(self, other, radius=6371008.771415, **adjust_limit_wrap) Approximate the distance between this and an other geohash using function pygeodesy.equirectangular. |
euclideanTo(self, other, **radius_adjust_wrap) Approximate the distance between this and an other geohash using function pygeodesy.euclidean. |
haversineTo(self, other, **radius_wrap) Compute the distance between this and an other geohash using the pygeodesy.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_wrap) Compute the distance between this and an other geohash using the pygeodesy.vincentys formula. |
Inherited from `unitsBase.Str`: `__call__`, `__repr__`, `__str__`, `join_`, `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`: `__imatmul__`, `__matmul__`, `__rmatmul__`, `attrs`, `classof`, `copy`, `dup`, `methodname`, `rename`, `renamed`, `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, lat_ghll, lon=None, precision=None, eps=2.220446049250313e-16, **name) New Geohash from an other Geohash instance or geohash `str` or from a lat- and longitude. |

Properties
| ab DEPRECATED, use property `philam`.
| 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`.
| precision Get this geohash's precision (`int`).
| resolution2 Get the lon- and latitudinal resolution of this cell in a Resolutions2Tuple`(res1, res2)`, both in `degrees`.
| sizes DEPRECATED on 2024.07.28, use property `Geohash.sizes3`.
| sizes3 Get the lat-, longitudinal and radial size of this cell in a Sizes3Tuple`(height, width, radius)`, all in `meter`.
| E Get the cell East of this (Geohash).
| N Get the cell North of this (Geohash).
| NE Get the cell NorthEast of this (Geohash).
| NW Get the cell NorthWest of this (Geohash).
| S Get the cell South of this (Geohash).
| SE Get the cell SouthEast of this (Geohash).
| SW Get the cell SouthWest of this (Geohash).
| W Get the cell West of this (Geohash).
Inherited from `unitsBase._NamedUnit`: `std_repr`, `units` Inherited from `named._Named`: `classname`, `classnaming`, `iteration`, `name`, `named`, `named2`, `named3`, `named4`, `sizeof`, `typename` Inherited from `object`: `__class__`

Method Details

### __new__ (cls, lat_ghll, lon=None, precision=None, eps=2.220446049250313e-16, **name) Static Method |
New Geohash from an other Geohash instance or geohash `str` or from a lat- and longitude. Arguments: `lat_ghll` - Latitude (`degrees90`), a geohash (Geohash, `str`) or a location (`LatLon`, `LatLon*Tuple`). `lon` - Logitude (`degrees180)`, required if `lat_ghll` is `degrees90`, ignored otherwise. `precision` - The desired geohash length (`int` 1..12) or `None` or `0`, see encode. `eps` - Optional inference tolerance (`degrees`), see encode. `name` - Optional `name=NN` (`str`). Returns: a new object with type S, a subtype of T New Geohash. Raises: `GeohashError` - Invalid `lat_ghll`. `RangeError` - Invalid `lat_gll` or `lon`. `TypeError` - Invalid `lat_ghll`. Overrides: object.__new__

### adjacent (self, direction, **name) |
Determine the adjacent cell in the given compass direction. Arguments: `direction` - Compass direction ('N', 'S', 'E' or 'W'). `name` - Optional `name=NN` (`str`) otherwise this cell's name, either extended with `.D`irection. Returns: Geohash of adjacent cell (Geohash). Raises: `GeohashError` - Invalid geohash or `direction`.

### 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, additional `LatLon` keyword arguments, ignored if `LatLon is None`. Returns: A Bounds2Tuple`(latlonSW, latlonNE)` of `LatLon`s or a Bounds4Tuple`(latS, lonW, latN, lonE)` if `LatLon is None`,

### 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) |
DEPRECATED, use method distanceTo. Decorators: `@deprecated_method`

### distance1 (self, other) |
DEPRECATED, use method distanceTo. Decorators: `@deprecated_method`

### distance2To (self, other, radius=6371008.771415, adjust=False, wrap=False) |
DEPRECATED, use method equirectangularTo. Decorators: `@deprecated_method`

### distance2 (self, other, radius=6371008.771415, adjust=False, wrap=False) |
DEPRECATED, use method equirectangularTo. Decorators: `@deprecated_method`

### distance3To (self, other, radius=6371008.771415, wrap=False) |
DEPRECATED, use method haversineTo. Decorators: `@deprecated_method`

### distance3 (self, other, radius=6371008.771415, wrap=False) |
DEPRECATED, use method haversineTo. Decorators: `@deprecated_method`

### equirectangularTo (self, other, radius=6371008.771415, **adjust_limit_wrap) |
Approximate the distance between this and an other geohash using function pygeodesy.equirectangular. 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`, see function pygeodesy.equirectangular. `adjust_limit_wrap` - Optional keyword arguments for function pygeodesy.equirectangular4, overriding defaults `adjust=False, limit=None` and `wrap=False`. 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_adjust_wrap) |
Approximate the distance between this and an other geohash using function pygeodesy.euclidean. Arguments: `other` - The other geohash (Geohash, `LatLon` or `str`). `radius_adjust_wrap` - Optional keyword arguments for function pygeodesy.euclidean. 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_wrap) |
Compute the distance between this and an other geohash using the pygeodesy.haversine formula. Arguments: `other` - The other geohash (Geohash, `LatLon` or `str`). `radius_wrap` - Optional keyword arguments for function pygeodesy.haversine. 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 is None`. Returns: This geohash location (`LatLon`) or if `LatLon is None`, a LatLon2Tuple`(lat, lon)`. Raises: `TypeError` - Invalid `LatLon` or `LatLon_kwds`.

### vincentysTo (self, other, **radius_wrap) |
Compute the distance between this and an other geohash using the pygeodesy.vincentys formula. Arguments: `other` - The other geohash (Geohash, `LatLon` or `str`). `radius_wrap` - Optional keyword arguments for function pygeodesy.vincentys. 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

### ab DEPRECATED, use property `philam`. Get method: ab(self) - DEPRECATED, use property `philam`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### latlon Get the lat- and longitude of (the approximate center of) this geohash as a LatLon2Tuple`(lat, lon)` in `degrees`. Get method: latlon(self) - Get the lat- and longitude of (the approximate center of) this geohash as a LatLon2Tuple`(lat, lon)` in `degrees`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### neighbors Get all 8 adjacent cells as a Neighbors8Dict`(N, NE, E, SE, S, SW, W, NW)` of Geohashes. Get method: neighbors(self) - Get all 8 adjacent cells as a Neighbors8Dict`(N, NE, E, SE, S, SW, W, NW)` of Geohashes. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### philam Get the lat- and longitude of (the approximate center of) this geohash as a PhiLam2Tuple`(phi, lam)` in `radians`. Get method: philam(self) - Get the lat- and longitude of (the approximate center of) this geohash as a PhiLam2Tuple`(phi, lam)` in `radians`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### precision Get this geohash's precision (`int`). Get method: precision(self) - Get this geohash's precision (`int`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### resolution2 Get the lon- and latitudinal resolution of this cell in a Resolutions2Tuple`(res1, res2)`, both in `degrees`. Get method: resolution2(self) - Get the lon- and latitudinal resolution of this cell in a Resolutions2Tuple`(res1, res2)`, both in `degrees`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### sizes DEPRECATED on 2024.07.28, use property `Geohash.sizes3`. Get method: sizes(self) - DEPRECATED on 2024.07.28, use property `Geohash.sizes3`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### sizes3 Get the lat-, longitudinal and radial size of this cell in a Sizes3Tuple`(height, width, radius)`, all in `meter`. Get method: sizes3(self) - Get the lat-, longitudinal and radial size of this cell in a Sizes3Tuple`(height, width, radius)`, all in `meter`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### E Get the cell East of this (Geohash). Get method: E(self) - Get the cell East of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### N Get the cell North of this (Geohash). Get method: N(self) - Get the cell North of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### NE Get the cell NorthEast of this (Geohash). Get method: NE(self) - Get the cell NorthEast of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### NW Get the cell NorthWest of this (Geohash). Get method: NW(self) - Get the cell NorthWest of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### S Get the cell South of this (Geohash). Get method: S(self) - Get the cell South of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### SE Get the cell SouthEast of this (Geohash). Get method: SE(self) - Get the cell SouthEast of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### SW Get the cell SouthWest of this (Geohash). Get method: SW(self) - Get the cell SouthWest of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### W Get the cell West of this (Geohash). Get method: W(self) - Get the cell West of this (Geohash). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.