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

Support 3d geometry #12

Merged
merged 4 commits into from
Apr 5, 2024
Merged

Support 3d geometry #12

merged 4 commits into from
Apr 5, 2024

Conversation

evetion
Copy link
Owner

@evetion evetion commented Aug 20, 2022

However, it's not straightforward to be compatible with 3th-party packages.

There are several flavors of 2d+ WKT/WKB. WKT should print Z, M, ZM in their type, but GDAL omits this when possible and only provides it for M. ArchGDAL doesn't fully Z/M geometries, so this is sometimes hard to test. WKB has two ways of providing the geometry type, one with bitflags, one with x-thousands added to the type. We parse both, but only write the flagged one, which seems to be default. Interestingly, LibGEOS(.jl) doesn't seem to support either.

Also improved parsing of type with regex.

Closes #6

@evetion evetion requested a review from visr August 20, 2022 15:23
@visr
Copy link
Collaborator

visr commented Aug 20, 2022

There are still quite some tests failing. In the @test docs I do see "The broken and skip keyword arguments require at least Julia 1.7."

@evetion
Copy link
Owner Author

evetion commented Aug 20, 2022

Yeah, sorry for the tests, I will rewrite them without having to use broken.

Copy link
Collaborator

@visr visr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really oversee the bit fiddling details, but based on the tests agains GEOS it looks good to me!

@evetion
Copy link
Owner Author

evetion commented Dec 19, 2022

Thanks. There's on thing to improve and that is to create real ArchGDAL Z geometries to test with (skipped for now). Actually passing three coordinates per point doesn't do the trick.

Comment on lines +20 to +33
("Point", ArchGDAL.createpoint(coord), false, false),
("PointZ", ArchGDAL.createpoint(coord3), true, true),
("LineString", ArchGDAL.createlinestring(coord, lcoord), false, false),
("LineStringZ", ArchGDAL.createlinestring(coord3, lcoord3, lcoord3), true, true),
("Polygon", ArchGDAL.createpolygon(coords), false, false),
("PolygonZ", ArchGDAL.createpolygon(coords3), true, true),
("MultiPoint", ArchGDAL.createmultipoint([coord, lcoord]), false, false),
("MultiPointZ", ArchGDAL.createmultipoint([coord3, lcoord3]), true, true),
("MultiLineString", ArchGDAL.createmultilinestring([[coord, lcoord], [coord, lcoord]]), false, false),
("MultiLineStringZ", ArchGDAL.createmultilinestring([[coord3, lcoord3], [coord3, lcoord3]]), true, true),
("MultiPolygon", ArchGDAL.createmultipolygon([coords, coords]), false, false),
("MultiPolygonZ", ArchGDAL.createmultipolygon([coords3, coords3]), true, true),
("Empty", ArchGDAL.createpoint(), false, false),
("Empty Multi", ArchGDAL.createmultipolygon(), false, false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be replaced by GeoInterface wrapper types, since they encode directly whether Z and M are specifically present?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They could be, but I mostly want to compare to GDAL and GEOS WKB/WKT functionality, so that would only introduce a layer of conversions.

@evetion evetion merged commit 15b96fb into main Apr 5, 2024
8 checks passed
@evetion evetion deleted the feat/ewkb branch April 5, 2024 09:09
@evetion evetion mentioned this pull request Apr 5, 2024
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

Successfully merging this pull request may close these issues.

Support ZM geometries
3 participants