Timor-Leste geographic datasets
Project description
Timor GIS
Timor Leste GIS data as Django models This initial release uses administrative boundariew from Estrada, tweaked to include Atauro as a separate entity, with pcode which are intended to match existing data from PNDS.
Data inputs are stored as gpkg files in Git LFS.
Syncing a new provider boundary drop
Provider datasets (Estrada, INTL/PNDS, ...) arrive in different CRS, field
schemas, code schemes, spellings and coverage. sync_provider_geo folds a drop
into the canonical importer data without moving stable pcodes (which exist to
match PNDS downstream). Suco identity is decided by polygon overlap, not names,
so respellings, re-parentings and duplicate names can't shift a code; anything
the provider introduces gets a freshly minted canonical code.
# 1. propose: reconcile against the current sukus.csv/gpkg, write the crosswalk + report
manage.py sync_provider_geo intl2024 --source /path/to/shapefiles --propose
# review timor_locations/data/crosswalk/sync_report.md; record any corrections
# in suco_overrides.csv (durable -- honoured verbatim on every re-run)
# 2. apply: regenerate sukus.gpkg + sukus.csv from the reviewed crosswalk
manage.py sync_provider_geo intl2024 --source /path/to/shapefiles --apply
--apply runs a hard geographic guard first: every suco must sit inside its
coded admin-post polygon, or the sync aborts. Provider configuration lives in
timor_locations/sync/adapters.py; the durable crosswalk + overrides + report
live under timor_locations/data/crosswalk/.
Environment
This is intended to be compatible with:
- Django 4.1+
- Python 3.10+
gh repo clone catalpainternational/timor_locations
cd timor_locations
poetry install
Development
- When developing please install prerequisites with
poetry install --with dev --no-root
Pre Commit
If pre-commit is installed your code will be checked before commit.
This includes
- black
- flake8
- isort
- mypy
The same checks are run on push. See pytest.yaml for details on the checks being run.
New Release
For a new release, change the version property in pyproject.toml and push a git tag with the version number
See build.yaml for details on release tagging
Changelog
0.2.0
Re-keyed onto the INTL ("New*Cod") code scheme. pcode is now a CharField
(was integer) holding the official INTL code — NewSucoCod / NewPostAdC /
NewMunCode / NewAldCode, zero-padded strings (e.g. suco 010106). This:
- gives every entity a real code from the source (no minted/NULL codes); the data is 466 sucos / 70 posts / 14 municipalities / 2238 aldeias, all current INTL 2024 boundaries, with re-parenting baked in as INTL's own structure;
- unifies the two import tracks —
import_timor_geo_data(sucos) andimport_timor_geo_data_2022(aldeias) now produce the same INTL-keyed sucos — and fixes a latent leading-zero bug (codes like08050104no longer truncated by anIntegerField); - replaces the idea of a single
legacy_pcodecolumn with aProviderCodetable: every scheme an area has been coded in (Estrada, INTL 2024, future vintages) is a row, so adding a scheme is INSERTs not a schema migration, and splits/merges/ renames are representable. Seed it from the committedsuco_crosswalk.csvwithmanage.py load_provider_codes; look codes up withcode_for(area, scheme). The crosswalk currently bridges sucos only — posts/municipalities/aldeias are not yet mapped. - Migration note: the model PK type changes int→str, and migration
0008flushes the four area tables before the type change so no stringified-integer code can survive the re-key. Run order on an existing DB:migrate→import_timor_geo_data→load_provider_codes. Downstream consumers that store or compare the pcode value must migrate (see the partisipa-import coordination). The importer is idempotent (upsert by INTL code) and re-runnable.
Also includes the Django-4.2 importer fix (see 0.0.9) and the reusable
sync_provider_geo pipeline. Known gap: suco Beduku (Liquiçá/Bazartete) is
absent from the INTL 2024 source and is not yet included.
0.0.9
- Fixed
import_timor_geo_data/import_timor_geo_data_2022for Django 4.2+: the upserts now use the plain base manager instead of the annotatedGeoDataManager, avoidingFOR UPDATE cannot be applied to the nullable side of an outer join(the manager annotates a nullable FK join that theupdate_or_create/get_or_createlocking SELECT can't lock). Data unchanged.
...
Manually Uploading a new version to PyPi
Bump pyproject.toml
Then run poetry build and poetry publish
poetry build
poetry publish
See the file build.yml for the workflow
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timor_locations-0.2.0.tar.gz.
File metadata
- Download URL: timor_locations-0.2.0.tar.gz
- Upload date:
- Size: 7.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97b236d3e0f434c9ea0c3250605f789c3a5026484e3120ceabb4771aa17c4369
|
|
| MD5 |
71f3edcbf8d64853591ffa96daf31c17
|
|
| BLAKE2b-256 |
f64d805866ff6ee821ce580fff37334060c13fb02f11e2f4d2a8a8a476165feb
|
File details
Details for the file timor_locations-0.2.0-py3-none-any.whl.
File metadata
- Download URL: timor_locations-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b4ba14d4de8c34cdd356a4d95c761a0d461e0212a61b43d7e0e63f9539b4faf
|
|
| MD5 |
ceaf1d071b6acc7745d3044d13c9f18d
|
|
| BLAKE2b-256 |
d3e7987960721f6160947f5594371f249eec9f54b32dbd565723d99dd4ea2531
|