Generate administrative boundaries from OpenStreetMap via Overpass
Project description
99boundaries
A simple command line utility to generate administrative boundaries from OpenStreetMap via Overpass and OSM Land Polygons.
Installation
Please make sure you have installed poetry locally. Then clone this repository and run poetry install from the root folder. In order to generate not only maritime but also land (coastal) boundaries, you will need to download land polygons derived from OpenStreetMap and generiously hosted here. To decrease the computation time please download the WGS84 split variant.
Usage & Examples
make_boundary --help
usage: make_boundary [-h] -a ALPHA2 [ALPHA2 ...] -f FORMATS [FORMATS ...] [-l ADMIN_LEVEL] [-d LAND_DATA_DIR]
[--debug] [--no-debug]
required arguments:
-a ALPHA2 [ALPHA2 ...], --alpha2 ALPHA2 [ALPHA2 ...]
List of ISO-3166-1 alpha2 country codes, e.g. ES FR DE
-f FORMATS [FORMATS ...], --formats FORMATS [FORMATS ...]
Output formats, one or multiple of shp, gpkg, csv, geojson, mapinfo
optional arguments:
-l ADMIN_LEVEL, --admin_level ADMIN_LEVEL
OSM administrative level, currently only level 2 supported. Read more at
https://wiki.openstreetmap.org/wiki/Key:admin_level
-d LAND_DATA_DIR, --land_data_dir LAND_DATA_DIR
Path to the OSM land data polygons folder, read more and download from
https://osmdata.openstreetmap.de/data/land-polygons.html
--debug
--no-debug
Depending on the selected country the processing time will vary. While the maritime boundaries will take a few seconds to be generated, the land boundaries will take longer due superior spatial detail. Land boundaries for countries with with greater coverage, e.g. the United States, Canada or France, can take up to 45 minutes to be generated and will require up to 8g of memory. The reasons are resource hungry geopandas overlay operations intersecting the maritime boundaries with the OSM land polygons dataset.
Generate the maritime boundary as GeoJSON for Australia:
make_boundary --alpha2 AU --formats geojson
Generate the maritime and land boundary as GeoJSON, GeoPackage and ESRI Shapefile for Spain:
make_boundary --alpha2 ES --formats geojson shp gpkg --land_data_dir /path/to/land-polygons-split-4326
Generate the maritime and land boundaries as CSV (geometry as WKT) for France and Canada:
make_boundary --alpha2 FR CA --formats csv --land_data_dir /path/to/land-polygons-split-4326
The file output formats can either be ESRI Shapefile, GeoJSON, CSV, GeoPackage or MapInfo and will be saved as archives into the data folder residing in path/to/nintynine-boundaries/nintynine_boundaries.
Future Work
The plan is to include further administrative levels for individual countries at a later stage.
Project details
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 nintynine_boundaries-0.1.0.tar.gz.
File metadata
- Download URL: nintynine_boundaries-0.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.11 Linux/6.17.12-200.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
386e6f0a047834439914628955ed39afa04e6fd7e1d1d2b4bd72b546cfe37f4d
|
|
| MD5 |
e9e8232f0633b60114f44f1d906eb5dd
|
|
| BLAKE2b-256 |
243f5f7f61ec853cebcefcdd9b214ada78d355b1afaa1301529a0c728dc209b9
|
File details
Details for the file nintynine_boundaries-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nintynine_boundaries-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.11 Linux/6.17.12-200.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8a72227b22d916888d012eca5e98c7d2b7b73981c2b1e6f420801cb3deceeab
|
|
| MD5 |
ff0259c24ecdf7845534f3b5f7600ec2
|
|
| BLAKE2b-256 |
5ef42d9490b7d8784502f96ed547e2d070124ca024c04f30b0e33b929df494f2
|