Skip to content
Novus Examples
geojson1.1 KB

Coordinate Precision — Float64 Round-Trip Hazards

Five features whose coordinates are the values that break naive JSON number handling: 17-significant-digit doubles, the classic 0.1 + 0.2 artefact, the largest float64 below 180, a 1e-7 offset, and coordinates written in exponent form. Re-serialising this file is where a parser quietly loses or gains a digit.

Preview — first 22 linesgeojson
{
  "type": "FeatureCollection",
  "properties": null,
  "features": [
    { "type": "Feature", "id": "shortest-roundtrip",
      "properties": { "note": "17 significant digits — the shortest form that round-trips" },
      "geometry": { "type": "Point", "coordinates": [-12.482000000000001, 47.064000000000007] } },
    { "type": "Feature", "id": "binary-artifact",
      "properties": { "note": "0.1 + 0.2 as float64" },
      "geometry": { "type": "Point", "coordinates": [0.30000000000000004, 0.1] } },
    { "type": "Feature", "id": "near-antimeridian",
      "properties": { "note": "the largest float64 strictly below 180" },
      "geometry": { "type": "Point", "coordinates": [179.99999999999997, 47.064] } },
    { "type": "Feature", "id": "subnormal-offset",
      "properties": { "note": "1e-7 degrees is about 11 millimetres of latitude" },
      "geometry": { "type": "Point", "coordinates": [1e-7, -1e-7] } },
    { "type": "Feature", "id": "exponent-notation",
      "properties": { "note": "JSON permits exponent form; many readers never emit it" },
      "geometry": { "type": "Point", "coordinates": [-1.2482E1, 4.7064E1] } }
  ]
}

Specifications

Format
GeoJSON (RFC 7946)
Features
5
Encoding
UTF-8
Line Endings
LF
Cases
17-significant-digit values, a binary addition artefact, the float64 immediately below 180, a 1e-7 offset, and exponent notation
Exponent Notation
true
Note
written literally so a re-serialising parser's output can be diffed byte for byte

Testing contract

Reference control
Scenario
Parse the file and write it out again, then diff the coordinates against the original.
Expected result
Every value round-trips to the same double; the exponent-form coordinates decode to -12.482 and 47.064, and 179.99999999999997 does not become 180.

What is a .geojson file?

GeoJSON is a JSON-based format for encoding geographic data structures such as points, lines, and polygons, along with their properties. It uses WGS84 longitude-latitude coordinates and standard feature and feature-collection objects. It is a common interchange format for web mapping and GIS.

How to use this file

Use an example GeoJSON file to test geometry parsing, coordinate handling, and mapping libraries or GIS pipelines that render or analyze spatial features.

How to use this file for testing

“Coordinate Precision — Float64 Round-Trip Hazards” is a deterministic Novus Examples fixture for Geospatial, JSON parsing, Serialization testing. GeoJSON, GPX, and KML files with points, lines, polygons, and tracks — for testing map tools, route parsers, and geo importers.

Documented properties for this file: UTF-8 · LF · GeoJSON (RFC 7946). Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Geospatial fixtures publish one invented territory across formats, with the coordinate reference system and feature counts documented in specs. Convert or reproject and diff against the twin in the same group; edge-case geometries state exactly which assumption they are built to break.

Code examples

import geopandas as gpd

gdf = gpd.read_file("float64-roundtrip.geojson")
print(gdf.head())
print(gdf.crs)

Generated by generation/geospatial.py. Free for any use, no attribution required — license.