browser-district
v0.1.2
Published
HTTP-Range client for the OSM district R-tree + per-locale name overlays. Resolves a (lat, lng) to the OSM admin areas, neighborhoods, parks, and protected areas at that point.
Maintainers
Readme
browser-district
Resolve a (lat, lng) to OSM administrative areas, neighborhoods, parks, and protected areas — directly in the browser, by sending a handful of HTTP Range requests against a static .drt file (no server). Check out the demo.
Usage
Unpkg
<script type="module">
import { LookupClient } from "https://unpkg.com/browser-district@latest/src/index.js";
const client = await new LookupClient().open();
await client.setLocale("en");
console.log(await client.lookup(40.7150, -73.9550));
// → [{ name: "Williamsburg", translatedName: "Williamsburg", bbox: [...], ... }]
</script>NPM
npm install browser-districtimport { LookupClient } from "browser-district";
const client = await new LookupClient().open();
await client.setLocale("en");
console.log(await client.lookup(40.7150, -73.9550, { refine: true }));The defaults point at the project's public R2 bucket. Pass { indexUrl, namesBaseUrl, manifestUrl } to the constructor to host the data files yourself.
