Skip to content

Geometry 3d-ness is not preserved at the type level by GI.convert nor AG.create*. #446

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

Open
asinghvi17 opened this issue Nov 13, 2024 · 0 comments

Comments

@asinghvi17
Copy link
Contributor

MWE:

julia> import ArchGDAL as AG, GeoInterface as GI

julia> geom = AG.fromWKT("MULTIPOLYGON (" *
                     "((0 4 8,4 4 8,4 0 8,0 0 8,0 4 8)," *
                     "(3 1 8,3 3 8,1 3 8,1 1 8,3 1 8))," *
                     "((10 4 8,14 4 8,14 0 8,10 0 8,10 4 8)," *
                     "(13 1 8,13 3 8,11 3 8,11 1 8,13 1 8)))")
Geometry: MULTIPOLYGON (((0 4 8,4 4 8,4 0 8,0 0 8,0 4 8),(3  ...  8)))

julia> typeof(geom)
ArchGDAL.IGeometry{ArchGDAL.wkbMultiPolygon25D}

julia> GI.coordinates(geom)
2-element Vector{Vector{Vector{Vector{Float64}}}}:
 [[[0.0, 4.0, 8.0], [4.0, 4.0, 8.0], [4.0, 0.0, 8.0], [0.0, 0.0, 8.0], [0.0, 4.0, 8.0]], [[3.0, 1.0, 8.0], [3.0, 3.0, 8.0], [1.0, 3.0, 8.0], [1.0, 1.0, 8.0], [3.0, 1.0, 8.0]]]
 [[[10.0, 4.0, 8.0], [14.0, 4.0, 8.0], [14.0, 0.0, 8.0], [10.0, 0.0, 8.0], [10.0, 4.0, 8.0]], [[13.0, 1.0, 8.0], [13.0, 3.0, 8.0], [11.0, 3.0, 8.0], [11.0, 1.0, 8.0], [13.0, 1.0, 8.0]]]

julia> GI.coordinates(geom) |> AG.createmultipolygon
Geometry: MULTIPOLYGON (((0 4 8,4 4 8,4 0 8,0 0 8,0 4 8),(3  ...  8)))

julia> geom
Geometry: MULTIPOLYGON (((0 4 8,4 4 8,4 0 8,0 0 8,0 4 8),(3  ...  8)))

julia> GI.coordinates(geom) |> AG.createmultipolygon |> typeof
ArchGDAL.IGeometry{ArchGDAL.wkbMultiPolygon}

julia> GI.coordinates(geom) |> AG.createmultipolygon |> GI.is3d
false

julia> GI.coordinates(geom) |> AG.createmultipolygon |> GI.ismeasured
false

julia> GI.coordinates(geom) |> AG.createmultipolygon |> GI.coordnames
(:X, :Y, :Z)

Not sure what the best way around this is - maybe a check before materializing the geometry?

@asinghvi17 asinghvi17 changed the title Geometry 3d-ness is not preserved at the type level by GI.convert nor AG.create*multipolygon*. Geometry 3d-ness is not preserved at the type level by GI.convert nor AG.create*. Nov 13, 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

No branches or pull requests

1 participant