-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a JLD2 extension to allow serializing geometries (#448)
* half finished JLD2 extension to serialize ArchGDAL geometries * use WellKnownBinary instead Co-authored-by: Maarten Pronk <[email protected]> * add JLD2 to extras for Julia <1.9 support * add back space * add compat bounds --------- Co-authored-by: Maarten Pronk <[email protected]>
- Loading branch information
1 parent
b6c95c1
commit c7aa0d6
Showing
4 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module ArchGDALJLD2Ext | ||
|
||
import ArchGDAL as AG | ||
import GeoInterface as GI | ||
import JLD2 | ||
|
||
struct ArchGDALSerializedGeometry | ||
# TODO: add spatial reference | ||
wkb::Vector{UInt8} | ||
end | ||
|
||
|
||
JLD2.writeas(::Type{<: AG.AbstractGeometry}) = ArchGDALSerializedGeometry | ||
|
||
function JLD2.wconvert(::Type{<: ArchGDALSerializedGeometry}, x::AG.AbstractGeometry) | ||
return ArchGDALSerializedGeometry(AG.toWKB(x)) | ||
end | ||
|
||
function JLD2.rconvert(::Type{<: AG.AbstractGeometry}, x::ArchGDALSerializedGeometry) | ||
return AG.fromWKB(x.wkb) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters