pyinterp.geohash.GeoHash#
- class pyinterp.geohash.GeoHash(self, lon: float, lat: float, precision: int)#
Bases:
objectGeohash: Base32 string encoding a rectangular geographic area.
Geohashing is a geocoding method used to encode geographic coordinates (latitude and longitude) into a short string of digits and letters delineating an area on a map, which is called a cell, with varying resolutions.
The more characters in the string, the more precise the location. The table below gives the correspondence between the number of characters, the size of the boxes of the grid at the equator and the total number of boxes:
precision
lng/lat (km)
samples
1
4950/4950
32
2
618.75/1237.50
1024
3
154.69/154.69
32768
4
19.34/38.67
1048576
5
4.83/4.83
33554432
6
0.60/1.21
1073741824
Geohashes use Base-32 alphabet encoding (characters can be 0 to 9 and A to Z, excl A, I, L and O).
The geohash is a compact way of representing a location, and is useful for storing a location in a database, or for indexing a location in a database.
Construct a GeoHash from longitude, latitude with number of characters.
- Parameters:
lon – Longitude of the point.
lat – Latitude of the point.
precision – Number of characters in the geohash (must be <= 12).
- Raises:
ValueError – If precision > 12.
Attributes
String representation of the geohash.
Number of bits used to represent the geohash.
Number of characters in the geohash.
Public Methods
area(self[, spheroid])Returns the area covered by this geohash.
bounding_box(self)Returns the bounding box of the geohash.
center(self)Returns the center point of this geohash.
integer_value(self[, round])Returns the value of the integer64 stored in the geohash.
neighbors(self)Returns the eight neighbors of this geohash.
Special Methods
__eq__(self, arg, /)__getstate__(self)__new__(*args, **kwargs)__repr__(self)__setstate__(self, arg, /)__str__(self)