Skip to content

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

Open
@mattwigway

Description

@mattwigway

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions