Skip to main content

Module exact_geojson

Module exact_geojson 

Source
Expand description

GeoJSON read with correctly rounded coordinates.

serde_json’s default float parser may read a decimal one or two units in the last place away from the nearest double (on the pinned Survey of India file: 42,109 of 505,208 coordinates, up to 2 ULP). Its float_roundtrip feature would change number parsing for the whole workspace, so the Survey of India files are read the way geolith-dataset-builder reads its areas: the text of each coordinates array is kept (serde_json raw_value) and every number in it is parsed with str::parse::<f64>, which is correctly rounded. Then a polygon file turned into lines is the lines file tools/india-boundary/derive.py writes, bit for bit.

Functions§

parse
The GeoJSON document text, every coordinate the correctly rounded f64 of its decimal text.