From d1a07e8860e2de29a142124e802f0febd749900f Mon Sep 17 00:00:00 2001 From: Jan Tschada Date: Fri, 20 Sep 2024 14:22:28 +0200 Subject: [PATCH] #3 Query the feature service - using location as spatial filter --- spatial-data-science/src/platformshell/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spatial-data-science/src/platformshell/src/main.rs b/spatial-data-science/src/platformshell/src/main.rs index c7dfab7..b5179c9 100644 --- a/spatial-data-science/src/platformshell/src/main.rs +++ b/spatial-data-science/src/platformshell/src/main.rs @@ -1,3 +1,4 @@ +use geo::Point; use reqwest::Url; use serde_esri::features::FeatureSet; use serde_json::json; @@ -54,14 +55,22 @@ mod tests { fn main() -> Result<(), Box> { + // Create a Point with latitude and longitude + let location = Point::new(7.116004, 50.719847); + let location_str = format!("{}, {}", location.x(), location.y()); + let location_wkid_str = "4326"; + + // Query the feature service let urban_hri_url = env::var("URBAN_HEAT_RISK_INDEX_FEATURE_SERVICE_URL")?; let query_url = Url::parse_with_params( &(urban_hri_url + "/query"), &[ ("where", "1=1"), - ("outFields", "*"), + ("geometryType", "esriGeometryPoint"), + ("geometry", &location_str), + ("inSR", &location_wkid_str), + ("outFields", "*"), ("returnGeometry", "true"), - ("resultRecordCount", "5"), ("f", "json"), ], )?;