pub struct GpkgBinaryParser;Expand description
Parser and encoder for the GeoPackageBinary (GPB) and WKB geometry formats.
The GeoPackageBinary layout is:
magic[2] = 0x47 0x50 ("GP")
version[1]
flags[1] bits 0-2: envelope indicator
bit 3: empty-geometry flag
bit 5: byte order (0=BE, 1=LE)
srs_id[4] i32, same byte order as flags bit 5
envelope 0/32/48/64 bytes depending on flags bits 0-2
WKB remainder of the blobImplementations§
Source§impl GpkgBinaryParser
impl GpkgBinaryParser
Sourcepub fn parse(data: &[u8]) -> Result<GpkgGeometry, GpkgError>
pub fn parse(data: &[u8]) -> Result<GpkgGeometry, GpkgError>
Parse a GeoPackageBinary blob into a GpkgGeometry.
§Errors
GpkgError::InvalidGeometryMagic— first two bytes are notGPGpkgError::InsufficientData— blob too shortGpkgError::WkbParseError/GpkgError::UnknownWkbType— WKB invalid
Sourcepub fn parse_wkb(data: &[u8]) -> Result<GpkgGeometry, GpkgError>
pub fn parse_wkb(data: &[u8]) -> Result<GpkgGeometry, GpkgError>
Parse a WKB (Well-Known Binary) blob into a GpkgGeometry.
Both big-endian (byte_order = 0) and little-endian (byte_order = 1)
WKB are supported.
Sourcepub fn to_wkb(geom: &GpkgGeometry) -> Vec<u8> ⓘ
pub fn to_wkb(geom: &GpkgGeometry) -> Vec<u8> ⓘ
Encode a GpkgGeometry as little-endian WKB.
Sourcepub fn to_gpb(geom: &GpkgGeometry, srs_id: i32) -> Vec<u8> ⓘ
pub fn to_gpb(geom: &GpkgGeometry, srs_id: i32) -> Vec<u8> ⓘ
Encode a GpkgGeometry as a GeoPackageBinary blob (no envelope, LE byte order).
The resulting bytes begin with the magic GP (0x47 0x50).
Auto Trait Implementations§
impl Freeze for GpkgBinaryParser
impl RefUnwindSafe for GpkgBinaryParser
impl Send for GpkgBinaryParser
impl Sync for GpkgBinaryParser
impl Unpin for GpkgBinaryParser
impl UnsafeUnpin for GpkgBinaryParser
impl UnwindSafe for GpkgBinaryParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more