Python SDK
The gisph package is the official Python SDK for api.gis.ph.
Installation
Section titled “Installation”# From the repo (until PyPI):pip install "gisph @ git+https://github.com/YahaayLabs/gis.ph-sdk-python.git"
# or clonegit clone https://github.com/YahaayLabs/gis.ph-sdk-python.gitcd gis.ph-sdk-pythonpip install -e .Requires Python 3.10+.
Quick start
Section titled “Quick start”Free-tier JSON (no API key)
Section titled “Free-tier JSON (no API key)”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.
Authenticated reverse geocode
Section titled “Authenticated reverse geocode”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.
Waterways paint session
Section titled “Waterways paint session”session = client.tiles.create_session("ph_waterways_lines", ttl_seconds=3600)maplibre_url = session["data"]["maplibre_url"]# Pass maplibre_url to MapLibre + pmtiles protocolSee Waterways. ODbL attribution required on maps.
Datasets & features
Section titled “Datasets & features”datasets = client.datasets.list()created = client.datasets.create({"name": "My points"})features = client.features.list_by_dataset(created["data"]["id"])See Datasets & Features.
Async client
Section titled “Async client”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)Resources
Section titled “Resources”| Attribute | Notes |
|---|---|
regions / provinces / municities | list, get |
barangays | list (province required), get, search |
geocode | reverse (auth) |
datasets | list, get, create, update, delete |
features | list, get, list_by_dataset, create, update, delete |
tiles | list, create_session |
Default base URL: https://api.gis.ph/v1.
Errors
Section titled “Errors”from gisph import GisPhAuthError, GisPhHTTPError, GisPhRateLimitError- GitHub: YahaayLabs/gis.ph-sdk-python
- Issue tracker / roadmap: sdk-python#1
- Live API: Scalar reference