itacart.interop
Export to standard geospatial formats.
Satisfies OGC DGGS Core requirements 18 and 19 (interoperability functions). The paper marks these as met by design; concrete exporters are what turn that into a demonstrable claim.
Provenance: new; the notebook did this ad hoc with GeoPandas.
Three edge conventions meet in this module and they are not the same. A cell is defined by straight edges in the sinusoidal plane, and that is the convention its area is computed under. Geodesic paths are a second convention, used wherever a distance on the ellipsoid is meant. GeoJSON imposes a third: RFC 7946 section 3.1.1 defines the line between two positions as a straight segment in longitude and latitude, and warns that it may differ markedly from the path along the curved surface. The exported polygon is therefore not the cell. The difference is a property of the format, not a defect to repair, and it is measured in the test suite rather than assumed.
Coordinates are never rounded. Six decimal places are roughly ten centimetres, which is smaller than a cell only down to resolution 10; from resolution 11 the whole cell is narrower than one rounding step and any rounding collapses it into a degenerate polygon that is still syntactically valid GeoJSON. Emitting full precision costs bytes and never lies.
Export and recovery are an inverse pair. Export and refill are not.
cells_to_geojson() writes the index into the Feature id member and
the cell’s vertices into the geometry; recover_from_geojson() reads the
index back out of the Feature. The pair returns the cell it was handed, and
it does so because the index travelled with the Feature rather than being
inferred from the coordinates. That is the scope of the claim and it is
stated rather than implied: a recovery handed a Feature whose geometry
belongs to another cell still answers the original index, and a named test
does exactly that. The geometry is exact in its own right, and separately –
the exported vertices, joined again as straight segments in the sinusoidal
plane, rebuild the cell to within a unit in the last place.
Taking the exported polygon for a new geographic geometry – joining its positions along the ellipsoid and filling the result – is neither half of that pair. It is reingestion of a rendering, and nothing here promises it returns the cell.
What reingestion costs, measured. Row 999 at resolution one holds exactly
six cells: four in the last column, one per quadrant, each absorbing the
border, and two prime-meridian triangles, which exist in the eastern
quadrants only because the western quadrants have no meridian column. Six is
the enumerated total of that row, not a sample of it. With orthodromic
densification at one kilometre the reingested outline covers 33.1111 per cent
of an absorber and 51.6779 per cent of a triangle. Both figures are
readings of that step rather than properties of the grid: refined, they
settle near 33.03 and 51.57 per cent, and the declared readings and the
settled ones are pinned together, so neither can be read as the other. Handed
such an outline, polyfill() under center never answers the
cell. For four of the six it raises rather than answering an empty cover,
because the figure that comes back holds no cell centre. For the two absorbers
of the eastern quadrants it answers the cap of their own hemisphere: every
absorber of the row comes back with an edge along the meridian, the cap’s
centroid lies exactly on that edge, and the centre rule moves a centre on an
outline a micrometre east before testing it, which puts that centroid inside
the two eastern figures and outside the two western ones. Under
intersects the cell is in the answer along with others the outline
touches; recover_from_geojson() returns the cell. An ordinary cell loses
less than a thousandth of its figure on the same route, so the loss belongs to
this row and not to the route.
Module constants
Property names written by |
Functions
Export a cell as WKT, one string per cell. |
|
Export a compositional index as a GeoJSON FeatureCollection. |
|
Export a whole index as a single WKT geometry. |
|
Fill every geometry of a GeoDataFrame into a compositional index. |
|
Fill every geometry of a GeoJSON object into a compositional index. |
|
Serialise arbitrary geometry, cutting it at the antimeridian. |
|
Read back the indices that |
|
Export a compositional index as a GeoDataFrame. |