Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wkt adapted for 3d/m change in geo #85

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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