From 280fb7a5ef1932ad50f907b563f006d0be65eb66 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 27 Apr 2023 21:49:52 -0400 Subject: [PATCH] Add ll parsing --- spatial-coordinate-systems/src/urls.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spatial-coordinate-systems/src/urls.rs b/spatial-coordinate-systems/src/urls.rs index 772a21d..51080e9 100644 --- a/spatial-coordinate-systems/src/urls.rs +++ b/spatial-coordinate-systems/src/urls.rs @@ -85,6 +85,14 @@ impl CoordinateUrls { return Ok(("", ret)); } } + + // From: https://help.parsehub.com/hc/en-us/articles/226061627-Scrape-latitude-and-longitude-data-from-a-Google-Maps-link + // https://maps.google.com/maps?ll=43.6474528,-79.3799409,&z=16&t=m&hl=en-US&gl=US&mapclient=apiv3): + if key == "ll" { + if let Ok((_str, ret)) = LatLon::parse(value.as_ref()) { + return Ok(("", ret)); + } + } } context("latlon not found in url", fail)(i) @@ -296,5 +304,11 @@ mod tests { 35.7224075, -78.4170755 ); + + p!( + "https://maps.google.com/maps?ll=43.6474528,-79.3799409,&z=16&t=m&hl=en-US&gl=US&mapclient=apiv3):", + 43.6474528, + -79.3799409 + ); } }