pub trait ToWkb {
// Required method
fn to_wkb_dialect(
&self,
dialect: WkbDialect,
dims: CoordDimensions,
srid: Option<i32>,
envelope: Vec<f64>
) -> Result<Vec<u8>>;
// Provided methods
fn to_wkb(&self, dims: CoordDimensions) -> Result<Vec<u8>> { ... }
fn to_ewkb(
&self,
dims: CoordDimensions,
srid: Option<i32>
) -> Result<Vec<u8>> { ... }
fn to_gpkg_wkb(
&self,
dims: CoordDimensions,
srid: Option<i32>,
envelope: Vec<f64>
) -> Result<Vec<u8>> { ... }
fn to_spatialite_wkb(
&self,
dims: CoordDimensions,
srid: Option<i32>,
envelope: Vec<f64>
) -> Result<Vec<u8>> { ... }
fn to_mysql_wkb(&self, srid: Option<i32>) -> Result<Vec<u8>> { ... }
}
Expand description
Convert to WKB.
§Usage example:
Convert a geo-types Point
to EWKB:
use geozero::{CoordDimensions, ToWkb};
let geom: geo_types::Geometry<f64> = geo_types::Point::new(10.0, -20.0).into();
let wkb = geom.to_ewkb(CoordDimensions::xy(), Some(4326)).unwrap();
assert_eq!(&wkb, &[1, 1, 0, 0, 32, 230, 16, 0, 0, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 52, 192]);
Required Methods§
sourcefn to_wkb_dialect(
&self,
dialect: WkbDialect,
dims: CoordDimensions,
srid: Option<i32>,
envelope: Vec<f64>
) -> Result<Vec<u8>>
fn to_wkb_dialect( &self, dialect: WkbDialect, dims: CoordDimensions, srid: Option<i32>, envelope: Vec<f64> ) -> Result<Vec<u8>>
Convert to WKB dialect.
Provided Methods§
sourcefn to_ewkb(&self, dims: CoordDimensions, srid: Option<i32>) -> Result<Vec<u8>>
fn to_ewkb(&self, dims: CoordDimensions, srid: Option<i32>) -> Result<Vec<u8>>
Convert to EWKB.
sourcefn to_gpkg_wkb(
&self,
dims: CoordDimensions,
srid: Option<i32>,
envelope: Vec<f64>
) -> Result<Vec<u8>>
fn to_gpkg_wkb( &self, dims: CoordDimensions, srid: Option<i32>, envelope: Vec<f64> ) -> Result<Vec<u8>>
Convert to GeoPackage WKB.
sourcefn to_spatialite_wkb(
&self,
dims: CoordDimensions,
srid: Option<i32>,
envelope: Vec<f64>
) -> Result<Vec<u8>>
fn to_spatialite_wkb( &self, dims: CoordDimensions, srid: Option<i32>, envelope: Vec<f64> ) -> Result<Vec<u8>>
Convert to Spatialite WKB.