{"_id":"settlementcheck","_rev":"2-fe5fe89e50ceec95a048302d695587f5","name":"settlementcheck","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.0-stage":{"name":"settlementcheck","version":"0.0.0-stage","_id":"settlementcheck@0.0.0-stage","stub":true,"maintainers":[{"name":"jaakla","email":"jaak.laineste@gmail.com"}],"dist":{"shasum":"524ee36c1944556cd4fc03dd54709204d32525c8","tarball":"https://registry.npmjs.org/settlementcheck/-/settlementcheck-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-XB4okfOkb6dFgYF3+eAT2/IeE562ULElbaMZE2vJLI4Me8n/ny+zAaouWlZaiYZGcnUV12ARddtCpqqZwZDKhA==","signatures":[{"sig":"MEYCIQCJjVriG6T9ZDGGY3khbShacXHTIWSLvBXE0ddonJF+ngIhAMkKKLKBCwF1mOFs2E8hPjwiQ04A1sDKom2KjQ2OaC+e","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":337},"_npmUser":{"name":"jaakla","email":"jaak.laineste@gmail.com"},"description":"Temporary package placeholder for staged publishing","directories":{}},"0.1.0":{"_id":"settlementcheck@0.1.0","bugs":{"url":"https://github.com/jaakla/trifold/issues"},"dist":{"shasum":"e172632d9835fd0df6ab3063d9f4595fb429996d","tarball":"https://registry.npmjs.org/settlementcheck/-/settlementcheck-0.1.0.tgz","fileCount":8,"integrity":"sha512-muEf6sVqz760cjbedSmpoNdjRhtZehVfFWAEGfJI7Y3C59RlLixtgfEjHntWtl6JVenVNghUv2jtf5KpL45Vwg==","signatures":[{"sig":"MEYCIQDXc7KuVvM4N/iGrdD1Ev4GX/WARGA428p3T64Ngbm8VQIhAKH4dTMusH2hdT1PfSe2YIKz0BC79xXYAQa3WThyyB2u","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBy/Cf0Bl7x/PLR51uFbZyLhx6Z/VpIvuj2QFKybYr5ZAiEAv6lMenyRE+reSiaoPWP9D85bGdyD4Ug/PK/tRyHdxIw="}],"unpackedSize":4612188},"name":"settlementcheck","type":"module","exports":{".":"./js/settlementcheck.mjs"},"gitHead":"753b97f7d5a8d048e0391d3240e13be914ad7156","license":"MIT","version":"0.1.0","_npmUser":{"name":"jaakla","email":"jaak.laineste@gmail.com"},"homepage":"https://jaakla.github.io/trifold/settlementcheck.html","keywords":["degurba","settlement","urban","rural","geospatial","offline","dggs"],"repository":{"url":"git+https://github.com/jaakla/trifold.git","type":"git","directory":"settlementcheck"},"_npmVersion":"11.17.0","description":"Offline GHS-WUP Degree of Urbanisation lookup on the Trifold T3 grid","directories":{},"maintainers":[{"name":"jaakla","email":"jaak.laineste@gmail.com"}],"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/settlementcheck_0.1.0_1792661607436_0.7142304462820335"}}},"time":{"created":"2026-10-22T09:27:09.901Z","modified":"2026-10-22T09:33:28.880Z","0.0.0-stage":"2026-10-22T09:27:09.901Z","0.1.0":"2026-10-22T09:33:27.636Z"},"description":"Offline GHS-WUP Degree of Urbanisation lookup on the Trifold T3 grid","maintainers":[{"name":"jaakla","email":"jaak.laineste@gmail.com"}],"readme":"# settlementcheck\n\n`settlementcheck` is a standalone, offline Python and JavaScript library for\nanswering which published GHS-WUP Degree of Urbanisation class contains a\nlongitude/latitude point. It bundles the R2025A, epoch-2025 Stage-I Level-2\nclassification as a **4.58 MB class-only Trifold T3 dataset**. Boundary\ndetails are optional and loaded by face on demand; they are not bundled in\nthe Python/npm core packages. The core plus every detail shard is 23.31 MB.\n\n`settlementcheck` is not yet published on PyPI or npm (checked 2026-10-22).\nFrom a checkout of this repository, install `pip install ./settlementcheck`\nor `npm install ./settlementcheck` from the repository root. Both source\npackages bundle the core dataset. See [Publication status](#publication-status)\nfor the remaining release steps.\n\n```python\nfrom settlementcheck import SettlementCheck\n\nsc = SettlementCheck()\nresult = sc.classify(24.7536, 59.4370)  # no details read\nprint(result.settlement_class, result.code)\n```\n\n```js\nimport { SettlementCheck } from \"settlementcheck\";\n\nconst sc = await SettlementCheck.fromFile();\nconsole.log(sc.classify(24.7536, 59.4370)); // no details read\n```\n\nThe full result includes the Level-2 code/name, derived Level-1 domain,\n`surface`, dominant `class_share`, explicit `mixed`, `nodata_mixed` and\n`no_data` state, T3 cell,\nsource release, year, projected-estimate marker, and 1 km source resolution.\n`is_urban()`/`isUrban()` means any code 21, 22, 23, or 30—not only an urban\ncentre. Level 1 classifies water in its residual “rural grid cell” domain;\nalways inspect `surface` when land/water matters.\n\n## Publication status\n\nThe package name returns 404 on both the\n[PyPI metadata endpoint](https://pypi.org/pypi/settlementcheck/json) and the\n[npm registry endpoint](https://registry.npmjs.org/settlementcheck).\nThe Python and npm manifests already define version 0.1.0, the public entry\npoints, core dataset, provenance manifest and data attribution notice.\nBuilding the Python sdist/wheel with `uv build` and the npm tarball with\n`npm pack` succeeds; clean installs of the wheel and tarball classify points\nusing their bundled data. No additional core packaging code or dataset build\nwas needed for those checks.\n\nThe remaining step is the first registry release, using accounts authorized\nto publish this name. From `settlementcheck/`, the release commands are:\n\n```sh\nuv build --out-dir dist\nuv publish dist/*\nnpm publish --access public\n```\n\nThe binary format is still documented as WIP v1 below; review that release\ncontract before publishing. Optional boundary shards remain a separate download.\nThis repository currently has no GitHub Actions publishing workflow, so\npublication is manual unless automation is added. After publishing, verify\nclean registry installs and change the installation instructions to\n`pip install settlementcheck` / `npm install settlementcheck`.\n\n## Optional, lazy boundary details\n\n`class_code`/`classCode`, `settlement`, `is_urban`/`isUrban` and\n`settlement_batch`/`settlementBatch` require only the core file. `classify`\nalso returns class labels, hierarchy, T3 address and provenance. Without\ndetails it explicitly returns null for share, mixture booleans and surface\n(except dominant nodata's `surface=\"unknown\"`), and `details_loaded=False`\n/ `detailsLoaded=false`. Missing detail data never means homogeneous.\n\nThe matching `degurba_R2025A_E2025_L12.details/` directory is available in\nthis repository and under the demo's `docs/data/`. Its manifest lists the\nsize and SHA-256 of each shard. Download it separately for fully offline use;\nshards range from 1.2 KB to 3.85 MB, and a point requires only one of 20 faces.\n\n```python\nsc = SettlementCheck(details_path=\"/path/to/degurba_R2025A_E2025_L12.details\")\nr = sc.check(24.7536, 59.4370)  # reads the local face only on first use\nprint(r.class_share, r.mixed, r.nodata_mixed)\nsc.unload_details()\n```\n\nPython never downloads data by default. For application-managed remote\nloading, supply `details_loader(face)` returning the matching shard's bytes.\nMissing local shards raise `DetailsNotLoadedError`; classification remains\navailable. The default local directory is beside the selected core file.\n\n```js\nconst sc = await SettlementCheck.fromUrl(\n  'https://jaakla.github.io/trifold/data/degurba_R2025A_E2025_L12.tfdg'\n);\nconst r = await sc.checkAsync(24.7536, 59.4370); // fetches one sibling shard\nconsole.log(r.classShare, r.mixed);\nsc.check(24.7536, 59.4370); // synchronous, only while this face is cached\nsc.unloadDetails();\n```\n\nJavaScript's synchronous `check` requires an already loaded face; use\n`await checkAsync` or `await loadDetails` for lazy loading. `fromBytes` accepts\n`{detailsLoader: async face => bytes}` when no source URL/path is known.\n`fromFile` uses a sibling local directory, and `fromUrl` uses sibling URLs.\n`checkBatchAsync` groups detailed lookups by face; `settlementBatch` never\nloads details. The default cache retains two faces, configurable with\n`cache_faces` / `cacheFaces` in 1..20. Failed loads are retryable, and JS\ncoalesces concurrent requests for the same face. JS loaders may have multiple\nin-flight faces; applications should bound concurrent requests as well.\n\nThe CLI returns class/provenance by default. Pass `--details /path/to/directory`\nfor a detailed result, or `--json` for the explicit loading/status fields.\n\nPopulation counts, settlement names and administrative polygons are separate\npotential enrichments, not boundary details. See [ENRICHMENTS.md](ENRICHMENTS.md)\nfor the inspected sources, licensing and proposed lazy-loading approach.\n\n## What the classes mean\n\nDEGURBA is not a set of interchangeable density bands. The published model\ncombines permanent-land density, cluster population, connectivity, distance,\nand urban-centre smoothing/gap filling. A class must not be converted back to\na numeric population density. The 2025 population input is projected, and a\nT3 boundary finer than 1 km does not create finer scientific information.\n\nThe eight values are `urban_centre` (30), `dense_urban_cluster` (23),\n`semi_dense_urban_cluster` (22), `suburban_or_peri_urban` (21),\n`rural_cluster` (13), `low_density_rural` (12),\n`very_low_density_rural` (11), and `water` (10). Source nodata is distinct.\n\n## Rebuild\n\nDownload the source ZIP named in [`data/manifest.json`](data/manifest.json),\nverify its SHA-256, extract the GeoTIFF, then run:\n\n```console\npython build.py --source /path/to/GHS_WUP_DEGURBA_E2025_GLOBE_R2025A_54009_1000_V1_0.tif --level 12 --jobs 2\n```\n\nBuild dependencies are Rasterio and NumPy. Scalar package lookups have no\nruntime dependency; install the `batch` extra for vectorized T3 location. See\n[`data/NOTICE.md`](data/NOTICE.md) for\nsource attribution and the change notice.\n\n## Resolution and limitations\n\nThe official class raster is authoritative. Homogeneous T3 ancestors are\nstored as intervals; boundary cells retain the dominant equal-area source\nclass, an 8-bit area share, and water/nodata mix flags. `class_share` describes\nthe transferred T3 cell—it is not a probability or scientific confidence.\nSmall or narrow source features can be represented only to the chosen T3\nlevel, and all source-model limitations remain.\n\n## TFDG v1 format\n\nThe format remains **WIP version 1**. The class-only layout uses flags 3;\nthe obsolete experimental monolithic layout is rejected and must be rebuilt.\nThe core contains independently compressed lengths and class slots. Detail\nshards contain sparse mixed intervals, 8-bit shares and two packed flag\nplanes. Both carry source metadata and a shared build identity that prevents\nmixing releases. TFDG uses uint32 base indexes and supports through L13.\nSee [FORMAT.md](FORMAT.md) for the exact binary layout and validation rules.\n","readmeFilename":"README.md","homepage":"https://jaakla.github.io/trifold/settlementcheck.html","keywords":["degurba","settlement","urban","rural","geospatial","offline","dggs"],"repository":{"url":"git+https://github.com/jaakla/trifold.git","type":"git","directory":"settlementcheck"},"bugs":{"url":"https://github.com/jaakla/trifold/issues"},"license":"MIT"}