[−][src]Struct vadeen_osm::OsmBuilder
OsmBuilder
makes it easy to build OSM maps from non OSM data. Polygons, multi polygons,
poly lines and points are all represented as lists of coordinates.
Nodes are automatically added and assigned ids. Ways and relations are automatically created with the correct references.
When building maps from OSM data the elements should be added directly to an Osm
struct to
preserve ids. You can also use the osm_io
module which do exactly that when reading data.
Examples
let mut builder = OsmBuilder::default(); // Add a polygon, which is represented as a way and two nodes in osm. builder.add_polygon( &[vec![(1.0, 1.0).into(), (2.0, 2.0).into()]], &[("key".to_owned(), "value".to_owned())] ); let osm = builder.build(); assert_eq!(osm.nodes.len(), 2); assert_eq!(osm.ways.len(), 1); assert_eq!(osm.relations.len(), 0); let boundary = osm.boundary.unwrap(); assert_eq!(boundary.min, (1.0, 1.0).into()); assert_eq!(boundary.max, (2.0, 2.0).into());
Methods
impl OsmBuilder
[src]
pub fn build(self) -> Osm
[src]
pub fn add_polygon(
&mut self,
parts: &[Vec<Coordinate>],
tags: &[(String, String)]
)
[src]
&mut self,
parts: &[Vec<Coordinate>],
tags: &[(String, String)]
)
pub fn add_polyline(
&mut self,
coordinates: &[Coordinate],
tags: &[(String, String)]
) -> i64
[src]
&mut self,
coordinates: &[Coordinate],
tags: &[(String, String)]
) -> i64
Trait Implementations
impl Default for OsmBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for OsmBuilder
impl Send for OsmBuilder
impl Sync for OsmBuilder
impl Unpin for OsmBuilder
impl UnwindSafe for OsmBuilder
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>,