Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using hs-geojson objects means trouble #8

Open
newmana opened this issue Jan 7, 2019 · 1 comment
Open

Using hs-geojson objects means trouble #8

newmana opened this issue Jan 7, 2019 · 1 comment

Comments

@newmana
Copy link
Collaborator

newmana commented Jan 7, 2019

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.

@dendrei
Copy link
Contributor

dendrei commented Jan 7, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants