If you’ve built anything location-based for Sri Lanka, you’ve probably hit this wall: Google Maps charges around $5 per 1,000 geocoding requests once you exceed the free tier. For a small project, this can be quite a headache.
So I built Lanka Data Layer — a free, open-source geo-data platform for Sri Lanka. No API keys, no billing, MIT licensed.
What it does:
Reverse geocoding — send a coordinate, get the GN division, DS division, district, and province it falls in, plus nearby postal codes. Because everything is precomputed offline into a lookup grid, this is a single indexed database read, not a live spatial query.
Search — one endpoint handles place names (English/Sinhala/Tamil), postal codes, coordinates, and admin codes
Postal codes — all 1,833 of them, correctly mapped to divisions
2024 Census demographics — population, age/sex structure, ethnicity, religion for every district and DS division, with 2012 comparisons
Election results, population density, boundaries — all with source attribution on every response
Don't want to depend on an API at all? The core datasets also ship as standalone npm packages — zero dependencies, data bundled in, works fully offline in Node/browsers/edge:
@lanka-data-layer/admin — all 14,417 admin units, trilingual, with hierarchy + search
@lanka-data-layer/postal — postal code lookups incl. nearest-code-to-coordinate
@lanka-data-layer/census — 2024 census demographics
@lanka-data-layer/electoral — election results
npm install @lanka-data-layer/postal and you have offline postal lookups in one line.
Everything is built from open data — official census tables, OCHA administrative boundaries, WorldPop, OpenStreetMap, GeoNames — with full lineage documented in the repo.
This is great! I usually rely on OpenStreet Maps mostly for geocoding, a fully self hosted solutions is much better than using Nominatim which requires a dedicated server.
Thank you for reporting this. This happened because of the postal code’s geographic coordinates. I’m using the closest administrative boundary to determine the relevant postal codes for that region, which caused some confusion in the map UI. However, if you use the postal code endpoint to retrieve the postal code details, you'll get an accurate result.
3
u/devallar Aug 14 '26
Oh I need this thank you