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

Parser does not work with views #31

Closed asinghvi17 closed 5 months ago

asinghvi17 commented 5 months ago

MWE:

julia> import GeoFormatTypes as GFT, WellKnownGeometry as WKG, GeoInterface as GI

julia> geoms = [UInt8[0x47, 0x50, 0x00, 0x01, 0x84, 0x08, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0xb0, 0x41, 0xd2, 0x8e, 0xc5, 0xa9, 0x15, 0x41, 0x40, 0xdb, 0xcf, 0xb9, 0xb0, 0x82, 0x08, 0x41]]

julia> GFT.WellKnownBinary(GFT.Geom(), view(geoms[1], (8+1):length(geoms[1])))
GeoFormatTypes.WellKnownBinary{GeoFormatTypes.Geom, SubArray{UInt8, 1, Vector{UInt8}, Tuple{UnitRange{Int64}}, true}}(GeoFormatTypes.Geom(), UInt8[0x01, 0x01, 0x00, 0x00, 0x00, 0xb0, 0x41, 0xd2, 0x8e, 0xc5  …  0x15, 0x41, 0x40, 0xdb, 0xcf, 0xb9, 0xb0, 0x82, 0x08, 0x41])

julia> GI.trait(ans)

julia> GFT.WellKnownBinary(GFT.Geom(), getindex(geoms[1], (8+1):length(geoms[1])))
GeoFormatTypes.WellKnownBinary{GeoFormatTypes.Geom, Vector{UInt8}}(GeoFormatTypes.Geom(), UInt8[0x01, 0x01, 0x00, 0x00, 0x00, 0xb0, 0x41, 0xd2, 0x8e, 0xc5  …  0x15, 0x41, 0x40, 0xdb, 0xcf, 0xb9, 0xb0, 0x82, 0x08, 0x41])

julia> GI.trait(ans)
PointTrait()
evetion commented 5 months ago

Hmm, this should be fixed on the latest release no? https://github.com/evetion/WellKnownGeometry.jl/compare/v0.2.2...v0.2.3#diff-773e6d7a9db5cfa8351f87520363401bb4ae8844d3dc386a3f097a6ef22de1f4R139

asinghvi17 commented 5 months ago

Will check now - it's possible my previous benchmarks were also affected by this.

asinghvi17 commented 5 months ago

Yep, this works. Sorry about the noise :D