geoenrich
geoenrich is a small, fast command-line tool that adds geospatial
attributes to a table of points. Give it a file with longitude and latitude
columns and it appends any of: distance to the nearest coast, bathymetric depth,
the sea or ocean name, the nearest country and municipality, or the nearest
location in a second table you supply.
It is written in Rust, uses no PROJ or GDAL (the geometry is hand-rolled and
pure Rust), and reads and writes Parquet, CSV, TSV, and the gzip variants
csv.gz and tsv.gz.
What you can do
| Command | Purpose |
|---|---|
coast | Distance to the nearest shoreline (GSHHG). |
depth | Bathymetric depth at the point (GEBCO grid). |
sea | Sea or ocean name at the point (IHO Sea Areas). |
place | Nearest country and municipality (Natural Earth + GISCO). |
nearest | Nearest location in a second table you supply, with its distance. |
How it works
Every command follows the same pipeline: read the input, reduce it to unique locations with rounded coordinates (3 decimals by default), enrich those unique locations in parallel, then join the results back onto every input row. A file with millions of rows but few distinct positions is therefore cheap to enrich, because only the distinct positions are ever looked up.
Quick example
# Distance to the nearest coast, in kilometers
geoenrich coast cores.parquet \
--data ./data/gshhg/gshhg-shp-2.3.7/GSHHS_shp/f
# Nearest fish farm to each measurement
geoenrich nearest cores.parquet --to farms.parquet --name-field farm_name
New here? Start with Installation, skim the Commands, then see the reference datasets each command needs.