geotiff_maker creates a single-band GeoTIFF from point-based soil moisture readings.
It reads a CSV file containing moisture samples, interpolates those values across a raster
grid, clips the result to a farm boundary from GeoJSON, and writes an output GeoTIFF in
EPSG:4326.
The generated raster stores moisture as byte values from 0 to 100, where each value
represents a percent moisture level. Pixels outside the farm boundary, or beyond the
optional distance limit, are written as NoData.
The CLI entrypoint is make_geotiff.py, which expects:
- A CSV file with the columns
moisture,latitude,longitude, andsampled_at - A boundary GeoJSON file containing a
PolygonorMultiPolygon
Example CSV header:
moisture,latitude,longitude,sampled_atRun locally:
python make_geotiff.py input/farm_moisture_200.csv --boundary-geojson input/farm_boundary.geojsonThis writes the output GeoTIFF to the output/ directory by default.
Useful options:
python make_geotiff.py input/farm_moisture_200.csv \
--boundary-geojson input/farm_boundary.geojson \
--output output/farm_moisture.tif \
--resolution-m 10 \
--max-distance-m 50 \
--nodata 255Option summary:
--boundary-geojson: required path to the farm boundary file--outputor-o: output directory or explicit.tif/.tifffile path--resolution-m: approximate raster resolution in meters, default10--max-distance-m: optional maximum distance from a sample point before a pixel becomes NoData--nodata: NoData byte value written to the GeoTIFF, must be between101and255
Run with Docker Compose:
docker compose build
docker compose run --rm geotiff_maker python make_geotiff.py input/farm_moisture_200.csv --boundary-geojson input/farm_boundary.geojson