Skip to content

Datasets & Features

Base URL (local): https://api.gis.ph

All endpoints below are mounted under /v1.

All /v1/* endpoints require an Authorization header:

Authorization: Bearer <token>

Supported token types:

  • Master token (legacy/admin): the value of APIKEY in your server env. This bypasses per-user scoping.
  • User API key (recommended for data access): gis_sk_<env>_<prefix>_<secret>
  • Dashboard Supabase JWT: a regular Supabase access token (JWT) from a logged-in dashboard session.

When authenticated as a user (API key or Supabase JWT), dataset/feature reads are scoped to the current user.

Most endpoints respond with:

{
"data": ...,
"error": null
}

On upstream/validation errors, you may receive:

{ "message": "..." }

GET /v1/datasets

Returns a list of datasets.

Query params

  • includeFeatures (optional): true | 1 | yes to include features per dataset.

Example (no features)

Terminal window
curl -s "https://api.gis.ph/v1/datasets"

Example (include features)

Terminal window
curl -s "https://api.gis.ph/v1/datasets?includeFeatures=true"

POST /v1/datasets

Creates a dataset. You can optionally create features in the same request by providing features.

Minimal payload

{
"name": "Custom School Locations"
}

More complete payload

{
"name": "Manila Flood Zones 2025",
"description": "Flood hazard polygons from 2025 survey",
"data_type": "vector",
"srid": 4326,
"geometry_type": "POLYGON",
"status": "ready",
"metadata": {
"source": "survey",
"tags": ["flood", "hazard", "manila"],
"original_format": "GeoJSON"
},
"storage_ref": null
}

Create dataset + features in one call

{
"name": "Custom School Locations",
"description": "Points for schools",
"data_type": "vector",
"srid": 4326,
"features": [
{
"geometry": { "type": "Point", "coordinates": [121.05, 14.58] },
"properties": { "name": "St. Scholastica's", "students": 1200 }
},
{
"geom": { "type": "Point", "coordinates": [121.06, 14.59] },
"properties": { "name": "Another School" }
}
]
}

curl example

Terminal window
curl -s -X POST "https://api.gis.ph/v1/datasets" \
-H "Content-Type: application/json" \
-d '{
"name": "Custom School Locations",
"data_type": "vector",
"srid": 4326
}'

Notes:

  • user_id is optional in the API schema, but your database/RLS rules may reject client-supplied owners.
  • Nested feature creation is best-effort: if feature insert fails, the server attempts to delete the newly-created dataset.

GET /v1/datasets/{id}

Returns a single dataset by id.

Terminal window
curl -s "https://api.gis.ph/v1/datasets/b2c3d4e5-f6g7-8901-bcde-fg2345678901"

PATCH /v1/datasets/{id}

Updates a dataset. Allows partial updates of fields like name, description, etc.

Payload

{
"name": "Updated Dataset Name",
"description": "New description"
}

curl example

Terminal window
curl -s -X PATCH "https://api.gis.ph/v1/datasets/b2c3d4e5-f6g7-8901-bcde-fg2345678901" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Dataset Name"
}'

GET /v1/features

Returns all features.

Terminal window
curl -s "https://api.gis.ph/v1/features"

GET /v1/features/{id}

Returns a single feature by id.

Terminal window
curl -s "https://api.gis.ph/v1/features/1"

GET /v1/features/dataset/{datasetId}

Returns all features belonging to a dataset.

Terminal window
curl -s "https://api.gis.ph/v1/features/dataset/b2c3d4e5-f6g7-8901-bcde-fg2345678901"

POST /v1/features

Creates a single feature.

Payload (GeoJSON-style geometry)

{
"dataset_id": "b2c3d4e5-f6g7-8901-bcde-fg2345678901",
"geometry": {
"type": "Point",
"coordinates": [121.05, 14.58]
},
"properties": {
"name": "St. Scholastica's",
"students": 1200,
"level": "secondary"
}
}

Payload (using geom)

{
"dataset_id": "b2c3d4e5-f6g7-8901-bcde-fg2345678901",
"geom": {
"type": "Polygon",
"coordinates": [
[
[121.04, 14.6],
[121.05, 14.6],
[121.05, 14.61],
[121.04, 14.61],
[121.04, 14.6]
]
]
},
"properties": { "risk_level": "high" }
}

curl example

Terminal window
curl -s -X POST "https://api.gis.ph/v1/features" \
-H "Content-Type: application/json" \
-d '{
"dataset_id": "b2c3d4e5-f6g7-8901-bcde-fg2345678901",
"geometry": {"type":"Point","coordinates":[121.05,14.58]},
"properties": {"name":"Test"}
}'

Notes:

  • dataset_id is required.
  • Provide either geom or geometry. The server maps geometrygeom before inserting.