Skip to content

Commit

Permalink
wkt adapted for 3d/m change in geo
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Apr 6, 2022
1 parent a9fc6d5 commit e68edbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ default = ["geo-types"]
[[bench]]
name = "parse"
harness = false

[patch.crates-io]
geo-types = { git = "https://github.com/nyurik/geo", branch = "dim" }
4 changes: 2 additions & 2 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ where
.map(Geometry::try_into)
.collect::<Result<_, _>>()?;

Ok(geo_types::GeometryCollection::new_from(geo_geometries))
Ok(geo_types::GeometryCollection::new(geo_geometries))
}
}

Expand Down Expand Up @@ -871,7 +871,7 @@ mod tests {
]);

let g_geometrycollection: geo_types::GeometryCollection<f64> =
geo_types::GeometryCollection::new_from(vec![
geo_types::GeometryCollection::new(vec![
geo_types::Geometry::Point(g_point),
geo_types::Geometry::MultiPoint(g_multipoint),
geo_types::Geometry::LineString(g_linestring),
Expand Down
6 changes: 3 additions & 3 deletions src/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ where
/// # extern crate wkt;
/// # extern crate geo_types;
/// # extern crate serde_json;
/// use geo_types::Point;
/// use geo_types::{Point, PointTZM};
///
/// #[derive(serde::Deserialize)]
/// struct MyType {
Expand All @@ -137,7 +137,7 @@ where
///
/// let json = r#"{ "geometry": "POINT (3.14 42)" }"#;
/// let my_type: MyType = serde_json::from_str(json).unwrap();
/// assert!(matches!(my_type.geometry, Some(Point(_))));
/// assert!(matches!(my_type.geometry, Some(PointTZM(_))));
///
/// let json = r#"{ "geometry": "POINT EMPTY" }"#;
/// let my_type: MyType = serde_json::from_str(json).unwrap();
Expand All @@ -156,7 +156,7 @@ where
geo_types::Geometry::try_from(wkt)
.map_err(D::Error::custom)
.and_then(|geom| {
use geo_types::Geometry::*;
use geo_types::GeometryTZM::*;
match geom {
Point(p) => Ok(Some(p)),
MultiPoint(mp) if mp.0.is_empty() => Ok(None),
Expand Down

0 comments on commit e68edbf

Please sign in to comment.