evetion / WellKnownGeometry.jl

Reading and writing Well Known Text (WKT) and Well Known Binary (WKB)
https://www.evetion.nl/WellKnownGeometry.jl/dev
MIT License
3 stars 2 forks source link

`GI.astext` fails on a simple `GI.Polygon` #37

Open rafaqz opened 2 days ago

rafaqz commented 2 days ago
julia> GI.astext(GI.Polygon([GI.LinearRing([(50, 60), (50, 61), (51, 61), (51, 60), (50, 60)])]))
ERROR: MethodError: no method matching ncoord(::GeoInterface.PolygonTrait, ::GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false
, Vector{Tuple{Int64, Int64}}, Nothing, Nothing}}, Nothing, Nothing})
Closest candidates are:
  ncoord(::Union{GeoInterface.GeometryCollectionTrait, GeoInterface.LineStringTrait, GeoInterface.LinearRingTrait, GeoInterface.MultiLineStringTrait, GeoInterface.MultiPoint
Trait, GeoInterface.MultiPolygonTrait, GeoInterface.PointTrait, GeoInterface.PolygonTrait}, ::GeoFormatTypes.WellKnownText{GeoFormatTypes.Geom}) at ~/.julia/dev/WellKnownGeo
metry/src/wkt.jl:136
  ncoord(::Union{GeoInterface.GeometryCollectionTrait, GeoInterface.LineStringTrait, GeoInterface.LinearRingTrait, GeoInterface.MultiLineStringTrait, GeoInterface.MultiPoint
Trait, GeoInterface.MultiPolygonTrait, GeoInterface.PointTrait, GeoInterface.PolygonTrait}, ::GeoFormatTypes.WellKnownBinary{GeoFormatTypes.Geom, <:AbstractVector{UInt8}}) a
t ~/.julia/dev/WellKnownGeometry/src/wkb.jl:164
  ncoord(::Any) at ~/.julia/packages/GeoInterface/FSgka/src/interface.jl:118
Stacktrace:
 [1] geometry_suffix(type::GeoInterface.PolygonTrait, geom::GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false, Vector{Tuple{In
t64, Int64}}, Nothing, Nothing}}, Nothing, Nothing})
   @ WellKnownGeometry ~/.julia/dev/WellKnownGeometry/src/wkt.jl:35
 [2] _getwkt!(data::Vector{Char}, type::GeoInterface.PolygonTrait, geom::GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false, Ve
ctor{Tuple{Int64, Int64}}, Nothing, Nothing}}, Nothing, Nothing}, first::Bool, repeat::Bool)
   @ WellKnownGeometry ~/.julia/dev/WellKnownGeometry/src/wkt.jl:92
 [3] getwkt!
   @ ~/.julia/dev/WellKnownGeometry/src/wkt.jl:110 [inlined]
 [4] getwkt
   @ ~/.julia/dev/WellKnownGeometry/src/wkt.jl:52 [inlined]
 [5] astext
   @ ~/.julia/dev/WellKnownGeometry/src/wkt.jl:248 [inlined]
 [6] astext(geom::GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false, Vector{Tuple{Int64, Int64}}, Nothing, Nothing}}, Nothing,
 Nothing})
   @ GeoInterface ~/.julia/packages/GeoInterface/FSgka/src/interface.jl:672
 [7] top-level scope
   @ REPL[42]:1
rafaqz commented 2 days ago

Its a GeoInterface bug...

evetion commented 2 days ago

Yep, fixing it now.