Open newmana opened 5 years ago
The other issue is that in hs-geojson objects lines and polygons can contain points of different coordinate schemes e.g. XY
, XYZ
points in the same line string. WKB has no way of expressing such objects.
E.g. the following is a valid hs-geojson object but cannot be correctly serialized (i.e. you can't round trip it).
Geospatial.GeoLine $ LineString.makeLineString (Geospatial.GeoPointXYZ (Geospatial.PointXYZ 3.0 4.0 5.0)) (Geospatial.GeoPointXY (Geospatial.PointXY 1.0 2.0)) Sequence.empty
This is because the coordinate type (XY
, XYM
, XYZ
, XYZM
) is defined for the whole LineString
, (or LinearRing
) in WKB.
As we discovered in #7 there are certain things you can express in WKB, WKT or GeoJSON that don't line up. You can express differing geometry types (2D and 3D) within a feature or a geometry types like 2D+M which doesn't exist in GeoJSON. Currently, if you roundtrip a 2D+M in WKB to GeoJSON it will come back as XYZ (the M vs Z is lost).
The solution would be to create types in wkt-geom (WKT, eWKT, WKB, GeoJSON) and show these mappings. Prevent these mappings from occurring, so WKB -> GeoJSON if XYM is an error.