Skip to content

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

Open
@asinghvi17

Description

@asinghvi17

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions