Skip to content

Python SDK

The gisph package is the official Python SDK for api.gis.ph.

Terminal window
# From the repo (until PyPI):
pip install "gisph @ git+https://github.com/YahaayLabs/gis.ph-sdk-python.git"
# or clone
git clone https://github.com/YahaayLabs/gis.ph-sdk-python.git
cd gis.ph-sdk-python
pip install -e .

Requires Python 3.10+.

from gisph import Client
with Client() as client:
regions = client.regions.list(limit=5)
print(regions["data"])
rows = client.barangays.list(province="Cebu", municipality="Poro", limit=10)
print([b["name"] for b in rows["data"]])

See Authentication → Free tier. GeoJSON / geometry still need a key.

from gisph import Client
client = Client(api_key="YOUR_API_KEY")
place = client.geocode.reverse(lat=10.3157, lng=123.8854)
print(place["data"]["barangay"], place["data"]["municity"])
client.close()

Full guide: Reverse geocode.

session = client.tiles.create_session("ph_waterways_lines", ttl_seconds=3600)
maplibre_url = session["data"]["maplibre_url"]
# Pass maplibre_url to MapLibre + pmtiles protocol

See Waterways. ODbL attribution required on maps.

datasets = client.datasets.list()
created = client.datasets.create({"name": "My points"})
features = client.features.list_by_dataset(created["data"]["id"])

See Datasets & Features.

from gisph import AsyncClient
async with AsyncClient(api_key="YOUR_API_KEY") as client:
place = await client.geocode.reverse(lat=10.3157, lng=123.8854)
AttributeNotes
regions / provinces / municitieslist, get
barangayslist (province required), get, search
geocodereverse (auth)
datasetslist, get, create, update, delete
featureslist, get, list_by_dataset, create, update, delete
tileslist, create_session

Default base URL: https://api.gis.ph/v1.

from gisph import GisPhAuthError, GisPhHTTPError, GisPhRateLimitError