diff --git a/CHANGES.md b/CHANGES.md index 0e3d1873d..e49d1b582 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ * Support `POINT EMPTY` in conversion to `geo_types`. Converts to `MultiPoint([])`. * +* Minimal support for JTS extension: `LINEARRING` by parsing it as a `LINESTRING`. ## 0.9.1 diff --git a/src/lib.rs b/src/lib.rs index 7b6a3efba..0dd204120 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,7 +80,7 @@ where let x = as FromTokens>::from_tokens_with_parens(tokens); x.map(|y| y.as_item()) } - w if w.eq_ignore_ascii_case("LINESTRING") => { + w if w.eq_ignore_ascii_case("LINESTRING") || w.eq_ignore_ascii_case("LINEARRING") => { let x = as FromTokens>::from_tokens_with_parens(tokens); x.map(|y| y.as_item()) } @@ -261,6 +261,17 @@ mod tests { } } + #[test] + fn support_jts_linearring() { + let mut wkt: Wkt = Wkt::from_str("linearring (10 20, 30 40)").ok().unwrap(); + assert_eq!(1, wkt.items.len()); + + match wkt.items.pop().unwrap() { + Geometry::LineString(_ls) => (), + _ => panic!("expected to be parsed as a LINESTRING"), + }; + } + #[test] fn test_debug() { let g = Geometry::Point(Point(Some(Coord {