pyinterp.geohash.index.GeoHash

class pyinterp.geohash.index.GeoHash(store: pyinterp.geohash.storage.abc.AbstractMutableMapping, precision: int = 3, synchronizer: Optional[pyinterp.geohash.lock.Synchronizer] = None)[source]

Bases: object

Geographics index based on GeoHash encoding.

Parameters
  • store (AbstractMutableMapping) – Object managing the storage of the index.

  • precision (int) –

    Accuracy of the index. By default the precision is 3 characters. The table below gives the correspondence between the number of characters (i.e. the precision parameter of this constructor), 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

  • synchronizer (lock.Synchronizer, optional) – Write synchronizer.

__init__(store: pyinterp.geohash.storage.abc.AbstractMutableMapping, precision: int = 3, synchronizer: Optional[pyinterp.geohash.lock.Synchronizer] = None) None[source]

Methods

GeoHash.box([box])

Selection of all data within the defined geographical area.

GeoHash.encode(lon, lat[, normalize, unicode])

Encode points into geohash with the given precision

GeoHash.extend(other)

Update the index with the key/value pairs from data, appending existing keys with the new data.

GeoHash.get_properties(store)

Reading index properties.

GeoHash.items([keys])

Returns the list of pair (key, value) defined in the index.

GeoHash.keys([box])

Returns all hash defined in the index.

GeoHash.set_properties()

Definition of index properties.

GeoHash.to_xarray([box])

Get the XArray containing the data selected in the index.

GeoHash.update(other)

Update the index with the key/value pairs from data, overwriting existing keys.

GeoHash.values([keys])

Returns the list of values defined in the index.

GeoHash.where(hash_codes)

Returns the start and end indexes of the different GeoHash boxes.

GeoHash.__len__()

GeoHash.__repr__()

Return repr(self).

Attributes

GeoHash.PROPERTIES

GeoHash.precision

Accuracy of this instance.

GeoHash.store

Gets the object hndling the storage of this instance.