Skip to content

Commit

Permalink
Update wkt to 0.11
Browse files Browse the repository at this point in the history
It looks like it supports 3D WKT now (plus an M measure) so it's maybe
time to plumb that all the way through properly? (similar to how it's
done in the Python tools?)
  • Loading branch information
Notgnoshi committed Jul 25, 2024
1 parent acc4a95 commit 1095c71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ rhai = {version="1.13", features=["only_i64", "no_index", "no_object", "no_time"
stderrlog = "0.6"
svg = "0.17"
wkb = "0.7"
wkt = "0.10"
wkt = "0.11"

[build-dependencies]
cc = {version="*", features=["parallel"], optional=true}
Expand Down
11 changes: 6 additions & 5 deletions generative/io/wkt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
type Error = wkt::conversion::Error;

fn try_from(wkt: Wkt<T>) -> Result<Self, Self::Error> {
let geometry = Geometry::try_from(wkt.item)?;
let geometry = Geometry::try_from(wkt)?;
Ok(geometry.into())
}
}
Expand Down Expand Up @@ -380,7 +380,7 @@ where
{
for geometry in geometries {
let wkt_geom = geometry.to_wkt();
writeln!(writer, "{}", wkt_geom.item).expect("Writing failed");
writeln!(writer, "{}", wkt_geom).expect("Writing failed");
}
}

Expand Down Expand Up @@ -545,11 +545,12 @@ mod tests {
}

#[test]
fn test_cant_parse_3d_sad_face() {
fn test_can_parse_3d() {
let wkt = b"POINT Z(1 2 3)";
let geometries = read_wkt_geometries(&wkt[..]);
let mut geometries = read_wkt_geometries(&wkt[..]);

assert_eq!(geometries.count(), 0);
let point = geometries.next();
assert_eq!(point, Some(Geometry::Point(Point::new(1.0, 2.0))));
}

#[test]
Expand Down

0 comments on commit 1095c71

Please sign in to comment.