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

LibGEOS.create{Point,LineString} still return Ptr{Nothing} #167

Open
mattwigway opened this issue May 8, 2023 · 2 comments
Open

LibGEOS.create{Point,LineString} still return Ptr{Nothing} #167

mattwigway opened this issue May 8, 2023 · 2 comments

Comments

@mattwigway
Copy link

In #149 and v0.8.0, LibGEOS geometry operations now work on wrapped geometries. However, the create... functions still return a bare GEOS pointer:

julia> using LibGEOS

julia> LibGEOS.createLineString([[1.1, 2.2], [3.3, 4.4]])
Ptr{Nothing} @0x0000...

julia> LibGEOS.createPoint([[1.1, 2.2]])
Ptr{Nothing} @0x0000....

This makes previously-working code like this stop working with a MethodError:

  MethodError: no method matching geointerface_geomtype(::Nothing)
  Closest candidates are:
    geointerface_geomtype(!Matched::GeoInterface.PointTrait) at ~/.julia/packages/LibGEOS/oez93/src/geo_interface.jl:3
    geointerface_geomtype(!Matched::GeoInterface.MultiPointTrait) at ~/.julia/packages/LibGEOS/oez93/src/geo_interface.jl:4
    geointerface_geomtype(!Matched::GeoInterface.LineStringTrait) at ~/.julia/packages/LibGEOS/oez93/src/geo_interface.jl:5

The PR description for #149 mentions that this error can occur, but implies that removing .ptr should solve the problem. However, in the code linked above, there is no use of .ptr. Switching to use LibGEOS.{Point,LineString} instead of LibGEOS.create{Point,LineString} solves the problem. I'm not sure if this is a bug in LibGEOS.jl or if the create... functions are internal, but as far as I can tell the documentation doesn't say not to use them.

@jw3126
Copy link
Member

jw3126 commented Jun 1, 2023

I think these are internal. Try

julia> LibGEOS.LineString([[1.1, 2.2], [3.3, 4.4]])
LINESTRING (1.1 2.2, 3.3 4.4)

julia> LibGEOS.Point([1.1, 2.2])
POINT (1.1 2.2)

@evetion
Copy link
Member

evetion commented Jun 1, 2023

Might be good to namespace the C API, so there is a better distinction between the public and private methods.

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

3 participants