[−][src]Struct geobuf::encode::Encoder
GeoJSON to Geobuf encoder
Implementations
impl Encoder
[src]
pub fn encode(
geojson: &JSONValue,
precision: u32,
dim: u32
) -> Result<Data, &'static str>
[src]
geojson: &JSONValue,
precision: u32,
dim: u32
) -> Result<Data, &'static str>
Returns a Geobuf encoded object from the given geojson value
Arguments
geojson
- Aserde_json::Value
that contains a valid geojson object.precision
- max number of digits after the decimal point in coordinates.dim
- number of dimensions in coordinates.
Example
use geobuf::encode::Encoder; use geobuf::geobuf_pb::Data_Geometry_Type; use serde_json; let geojson = serde_json::from_str(r#"{"type": "Point", "coordinates": [100.0, 0.0]}"#).unwrap(); let geobuf = Encoder::encode(&geojson, 6, 2).unwrap(); assert_eq!(geobuf.get_dimensions(), 2); assert_eq!(geobuf.get_precision(), 6); assert_eq!(geobuf.get_geometry().get_field_type(), Data_Geometry_Type::POINT);
Auto Trait Implementations
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,