#water #osm #polygon #geo-json #bodies #intersection #gis

app osm-waters

Obtain the necessary OSM water bodies for your project. It finds the water polygons that intersect your chosen geometries and outputs the results into GeoJSON.

8 releases

0.2.2 Apr 4, 2024
0.2.0 Apr 3, 2024
0.1.5 Jan 9, 2024
0.1.1 Dec 17, 2023

#60 in Geospatial

Download history 36/week @ 2024-01-06 35/week @ 2024-02-17 40/week @ 2024-02-24 225/week @ 2024-03-30 42/week @ 2024-04-06

267 downloads per month

MIT/Apache

63KB
321 lines

osm-wate.rs

osm-waters allows you to get the resulting polygons from the intersection of OSM water bodies and your chosen geometries.

Install

To install osm-wate.rs:

cargo install osm-waters

# Or if building from source:
cargo install --path .

Go here to install Cargo.

Usage

Below are some examples on how to use osm-waters:

Example 1: basic

osm-waters --target my_target.geojson --water water_polygons.shp --output intersecting_geometries.geojson

Example 2: let osm-waters download the OSM water data

osm-waters --target example.geojson --output intersecting_geometries.geojson --download

Example 3: keep the download files

osm-waters --target example.geojson --output intersecting_geometries.geojson --download --keep

Flags

  • --target takes a GeoJSON or SQL file that queries geometries from a database. See the /tests directory for examples.
  • --water takes the OSM water polygons from OSM water polygons. This file must be a shapefile.
  • --output is used to set the path of where the resulting GeoJSON file will be saved.
  • --download downloads the OSM water data
  • --keep keeps the downloaded data
  • --srid is used to choose the coordinate system. The OSM water file provided must be in such such srid. In addition, the output will also be in the chosen srid. Default srid is 4326.

Future improvements

  • Reintroduced database option - include choose geom.
  • Improve error handling.
  • Args need better parsing/validation.
  • Allow outputs other than GeoJSON, this may be geoparquet, duckdb or shapefile.
  • Get osm-waters to Homebrew.

License

See LICENSE

Dependencies

~20–34MB
~547K SLoC