Skip to content

Commit

Permalink
use WellKnownBinary instead
Browse files Browse the repository at this point in the history
Co-authored-by: Maarten Pronk <[email protected]>
  • Loading branch information
asinghvi17 and evetion committed Nov 13, 2024
1 parent c494bc5 commit 75aa60d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ext/ArchGDALJLD2Ext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import GeoInterface as GI
import JLD2

struct ArchGDALSerializedGeometry
wkbtype::AG.OGRwkbGeometryType
coords::Vector
# TODO: add spatial reference
wkb::Vector{UInt8}
end


JLD2.writeas(::Type{<: AG.AbstractGeometry{WKBType}}) where WKBType = ArchGDALSerializedGeometry{WKBType}
JLD2.writeas(::Type{<: AG.AbstractGeometry}) = ArchGDALSerializedGeometry

function JLD2.wconvert(::Type{<: ArchGDALSerializedGeometry{WKBType}}, x::AG.AbstractGeometry{WKBType}) where WKBType
return ArchGDALSerializedGeometry{WKBType}(GI.coordinates(x))
function JLD2.wconvert(::Type{<: ArchGDALSerializedGeometry}, x::AG.AbstractGeometry)
return ArchGDALSerializedGeometry(AG.toWKB(x))
end

function JLD2.rconvert(::Type{<: AG.AbstractGeometry{WKBType}}, x::ArchGDALSerializedGeometry{WKBType}) where WKBType
return AG.lookup_method[typeof(x.trait)](x.coords)
function JLD2.rconvert(::Type{<: AG.AbstractGeometry}, x::ArchGDALSerializedGeometry)
return AG.fromWKB(x.wkb)
end

end

0 comments on commit 75aa60d

Please sign in to comment.