[][src]Module no_proto::pointer::geo

Represents a Geographic Coordinate (lat / lon)

When geo4, geo8, or geo16 types are used the data is saved and retrieved with this struct.

use no_proto::error::NP_Error;
use no_proto::NP_Factory;
use no_proto::pointer::geo::NP_Geo;
 
let factory: NP_Factory = NP_Factory::new(r#"{
   "type": "geo4"
}"#)?;

let mut new_buffer = factory.empty_buffer(None, None);
new_buffer.set("", NP_Geo::new(4, 45.509616, -122.714625))?;
 
assert_eq!("{\"lat\":45.5,\"lng\":-122.71}", new_buffer.get::<NP_Geo>("")?.unwrap().into_json().stringify());

Structs

NP_Geo

Holds geographic coordinates

NP_Geo_Bytes

Allows you to efficiently retrieve just the bytes of the geographic coordinate