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

is3d and ismeasured are missing #303

Closed
evetion opened this issue May 21, 2022 · 3 comments · Fixed by #290
Closed

is3d and ismeasured are missing #303

evetion opened this issue May 21, 2022 · 3 comments · Fixed by #290

Comments

@evetion
Copy link
Collaborator

evetion commented May 21, 2022

Encountered in #290.

is3d and ismeasured are missing which makes finding out which coordinate dimensions are implemented difficult. They're easily implemented though:

"""
    is3d(geom::AbstractGeometry)

Returns `true` if the geometry has a z coordinate, otherwise `false`.
"""
is3d(geom::AbstractGeometry)::Bool = GDAL.ogr_g_is3d(geom.ptr) == 1

"""
    ismeasured(geom::AbstractGeometry)

Returns `true` if the geometry has a m coordinate, otherwise `false`.
"""
ismeasured(geom::AbstractGeometry)::Bool = GDAL.ogr_g_ismeasured(geom.ptr) == 1

However, a simple test gives the following:

julia> point =  AG.createpoint(100, 70, 1)
Geometry: POINT (100 70 1)
julia> is3d(point)
false
julia> AG.GDAL.ogr_g_is3d(point.ptr)
2

Not sure if related, but looking at the source (https://github.dev/OSGeo/gdal/blob/9e9f8b294418e5f2670dacd5cacb5d6cdeabb797/ogr/ogr_geometry.h#L405), I can see that the is3d flag being set is 2 in this case.

Because of this oddity, I haven't yet implemented it.

@evetion
Copy link
Collaborator Author

evetion commented May 22, 2022

Well, the functions ogr_g_is3d and similar ones don't return a boolean, but just the & result. isempty only worked because it's flag is 0x1 😓.

@evetion
Copy link
Collaborator Author

evetion commented May 22, 2022

Implemented in #290

@yeesian
Copy link
Owner

yeesian commented May 22, 2022

Leaving this open until #290 is merged.

@yeesian yeesian reopened this May 22, 2022
@yeesian yeesian linked a pull request May 22, 2022 that will close this issue
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 a pull request may close this issue.

2 participants