geosquare-engine
Install with pip install geosquare-engine. Version 0.3.0 is on PyPI. It needs Python 3.11 to 3.14. It has a pandas and Polars accessor, df.gsq, that is optional.
accessor.py
import geosquare_engine.pandas_gsq # registers df.gsq
import pandas as pd
df = pd.DataFrame({"gid": ["H2X545M5X4E2", "H2X545M5X4E3"], "value": [1, 2]})
print(df.gsq.parent(9).tolist()) # ['H2X545M5X', 'H2X545M5X']
print(df.gsq.level().tolist()) # [12, 12]The accessor needs pandas or Polars installed. The engine has no dependency on them. Example from the engine quick start.
geosquare-v2
Install with python -m pip install "geosquare-v2[registry]". Version 1.3.0 is on PyPI. The quick start reads the trust file and registry in the git repo, so run it from a clone.
point_to_cell.py
cell = service.point_to_cell("ID", longitude=106.8456, latitude=-6.2088, level=9)
print(cell.uri) # geosquare:v2:ID:H2X545V39The service object is built as shown in examples/quickstart.py. Production code must manage its own trusted public keys.