diff --git a/.vscode/settings.json b/.vscode/settings.json index 11b1a49..93e6b7a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,5 +18,6 @@ "markdownlint.config": { "MD033": false, "MD028":false - } + }, + "editor.inlayHints.enabled": "offUnlessPressed" } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 4e1e633..fb682d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -873,7 +873,7 @@ dependencies = [ [[package]] name = "nicklinref" -version = "1.0.0" +version = "1.1.0" dependencies = [ "byteorder", "bytes", diff --git a/Cargo.toml b/Cargo.toml index ef263bf..560856e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nicklinref" -version = "1.0.0" +version = "1.1.0" description = "nicklinref is a server that slices segments of the Main Roads Western Australia road network based on slk" authors = ["thehappycheese"] edition = "2021" diff --git a/__static_http/main.js b/__static_http/main.js index 6f9dafb..d1ccfe0 100644 --- a/__static_http/main.js +++ b/__static_http/main.js @@ -113,10 +113,26 @@ add_features(new URLSearchParams(window.location.search)).then(success => succes ////////////////////////////////////////////////////////////////////// // Get Geometry // Optionally, use a Fetch_Queue to avoid browser error from too many parallel requests -// For which the fetch API itself provides no convienient work-around +// For which the fetch API itself provides no convenient work-around /////////////////////////////////////////////////////////////////////// async function add_features(url_params, fetch_pool = undefined) { + + + if(url_params.has("format") && url_params.has("items")){ + url_params.set("format","wkt") + return fetch("/batch2/?"+url_params.toString()) + .then(response=>response.json()) + .then(items=>items + .filter(item=>item) + .map(item=>{ + let read_features = new ol.format.WKT().readFeatures(item,{ featureProjection, dataProjection }); + layer_geojson.getSource().addFeatures(read_features); + }) + ).then(()=>true); + } + + f = url_params.get("f") ?? "geojson"; if(!(f.toLowerCase()==="latlon" || f.toLowerCase()==="latlondir")){ url_params.set("f","wkt");// geojson is default diff --git a/changelog.md b/changelog.md index 4f9ac19..b36bcb1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## [1.1.0] 2024-06-13 + +- Add routes `/batch2`, `/line` and `/point` which all support both a `GET` and `POST` method + ## [1.0.0] 2023-06-12 - drop support for case insensitive queries diff --git a/README.md b/readme.md similarity index 90% rename from README.md rename to readme.md index 6e06781..2a2734f 100644 --- a/README.md +++ b/readme.md @@ -31,10 +31,12 @@ create and visualise geometry based on live data. Below is a screenshot of NickM - [3.3.3. `f=` Parameter](#333-f-parameter) - [3.4. Browser - `/show/` Page](#34-browser---show-page) - [3.5. Advanced - `/batch/` Route](#35-advanced---batch-route) - - [3.6. Additional Usage Notes](#36-additional-usage-notes) - - [3.6.1. SLK, True Distance and Chainage](#361-slk-true-distance-and-chainage) - - [3.6.2. Supported Network Types](#362-supported-network-types) - - [3.6.3. Coordinate Reference System (CRS)](#363-coordinate-reference-system-crs) + - [3.6. `/batch2` unified batch requests](#36-batch2-unified-batch-requests) + - [3.7. `/point` and `/line` routes](#37-point-and-line-routes) + - [3.8. Additional Usage Notes](#38-additional-usage-notes) + - [3.8.1. SLK, True Distance and Chainage](#381-slk-true-distance-and-chainage) + - [3.8.2. Supported Network Types](#382-supported-network-types) + - [3.8.3. Coordinate Reference System (CRS)](#383-coordinate-reference-system-crs) - [4. Running the Server Yourself](#4-running-the-server-yourself) - [4.1. Installation](#41-installation) - [4.2. Compilation](#42-compilation) @@ -343,18 +345,85 @@ The output of the script above is shown below: -### 3.6. Additional Usage Notes +### 3.6. `/batch2` unified batch requests -#### 3.6.1. SLK, True Distance and Chainage +A new batch request route has been added to allow requesting both line and point features. + +This route accepts either a `POST`or `GET` requests. + +This version of the batch route does not use the complex binary protocol described above. + +The format of the request is as follows; + +```json +{ + "format":"wkt", + "items":[ + { + "road":"H001", + "slk_from":10, + "slk_to":20, + "offset":10 + }, + { + "road":"H016", + "slk":10 + }, + { + "road":"H015", + "slk":10 + } + ] +} +``` + +When url encoded the above query should look like; + +```text +format=wkt&items=%5B%7B%27road%27%3A+%27H001%27%2C+%27slk_from%27%3A+10%2C+%27slk_to%27%3A+20%2C+%27offset%27%3A+10%7D%2C+%7B%27road%27%3A+%27H016%27%2C+%27slk%27%3A+10%7D%2C+%7B%27road%27%3A+%27H015%27%2C+%27slk%27%3A+10%7D%5D +``` + +Formats supported are restricted to `wkt`, `geojson` or `json` + +The result type is always a JSON list which is the same length as the `"items"` specified in the request. + +Items that did not return a result may be either `null` or, due to a long outstanding issue, an invalid empty geometry like `MULTIPOINT ()` or a GeoJSON object with 0 coordinates. + + If `format=wkt` is specified, then each item will be either `null` or a `"wkt string"`. The result should look like; + +```json +200 +["MULTILINESTRING ((115.94759478043025 -32.02724359866268,...., 116.00968185354726 -32.0797516372457))","MULTIPOINT ((115.8018372737292 -31.890062043719624),(115.80208275968369 -31.88999214761082))","MULTIPOINT ((115.85393141776753 -32.048215776792965),(115.85365425352151 -32.04809166414051))"] +``` + +### 3.7. `/point` and `/line` routes + +The `/point` and `/line` routes support BOTH `GET` and `POST` requests. + +> Note: The first version of this server supported only `GET` requests against the +> root path `/` using url query parameters. To add support `POST` requests, I +> had to create two new routes `/line` and `/point`. +> +> For backward compatibility `GET`, requests against root `/` will continue to +> work. + +`POST` requests made against `/line` or `/route` must use the same parameters as +documented above, but formatted as JSON in the body of the request. For example +`GET localhost:8080/?road=H001&slk=10` becomes `POST localhost:8080/point` with +JSON body `{"road":"H001", "slk":10}` + +### 3.8. Additional Usage Notes + +#### 3.8.1. SLK, True Distance and Chainage SLK stands for "Straight Line Kilometre" and is sometimes called 'chainage' or 'kilometrage' in other contexts. At Main Roads Western Australia SLK refers to an "adjusted" linear measure which -has discontinuities called 'Points of Equation' (POE) (there are between 100 and 200 -points of equation throughout the state road network) where there is an abrupt -increase or decrease in SLK. This is done so that when asset locations are -recorded by SLK, these records are not invalidated when a road realignment +has discontinuities called 'Points of Equation' (POE) (there are between 100 and +200 points of equation throughout the state road network) where there is an +abrupt increase or decrease in SLK. This is done so that when asset locations +are recorded by SLK, these records are not invalidated when a road realignment project modifies the length of a road. This software has no special compensation to handle POE discontinuities. Please @@ -365,7 +434,7 @@ The non-adjusted linear measure is called "True Distance". This software is only capable of looking up Lat/Lon from SLK. True distance is not yet supported. -#### 3.6.2. Supported Network Types +#### 3.8.2. Supported Network Types This tool is capable of querying all road network types included in this dataset @@ -379,7 +448,7 @@ This tool is capable of querying all road network types included in this dataset | Miscellaneous Road | ✔️ | | Crossover | ✔️ | -#### 3.6.3. Coordinate Reference System (CRS) +#### 3.8.3. Coordinate Reference System (CRS) The coordinate system of the returned geometry depends on the coordinate system downloaded from `NLR_DATA_SOURCE_URL`. diff --git a/src/data/cached/mod.rs b/src/data/cached/mod.rs index d7e382a..ad0358d 100644 --- a/src/data/cached/mod.rs +++ b/src/data/cached/mod.rs @@ -8,6 +8,4 @@ mod layer; pub use layer::Layer; mod feature; -pub use feature::Feature; - -pub use nickslinetoolsrust::vector2::Vector2; \ No newline at end of file +pub use feature::Feature; \ No newline at end of file diff --git a/src/filters/custom_rejection_handler.rs b/src/filters/custom_rejection_handler.rs index 02b3fe0..c60f1e5 100644 --- a/src/filters/custom_rejection_handler.rs +++ b/src/filters/custom_rejection_handler.rs @@ -1,8 +1,6 @@ use crate::helpers::ErrorWithStaticMessage; use warp::{ - http::{StatusCode}, - reply::Response, - Rejection, Reply, reject::{InvalidQuery, MethodNotAllowed}, + http::StatusCode, reject::{InvalidQuery, MethodNotAllowed, UnsupportedMediaType}, reply::Response, Rejection, Reply }; pub async fn custom_rejection_handler(rejection: Rejection) -> Result { @@ -13,23 +11,21 @@ pub async fn custom_rejection_handler(rejection: Rejection) -> Result() { code = StatusCode::INTERNAL_SERVER_ERROR; message = custom_reject.get_message().to_owned(); - } else if let Some(custom_reject) = rejection.find::() { code = StatusCode::BAD_REQUEST; message = custom_reject.to_string(); - } else if let Some(custom_reject) = rejection.find::() { code = StatusCode::METHOD_NOT_ALLOWED; message = custom_reject.to_string(); - + } else if let Some(custom_reject) = rejection.find::(){ + code = StatusCode::UNSUPPORTED_MEDIA_TYPE; + message = custom_reject.to_string(); } else { code = StatusCode::INTERNAL_SERVER_ERROR; message = "Unexpected error".to_owned(); - } let res = warp::http::Response::builder() diff --git a/src/filters/get_combined_filters.rs b/src/filters/get_combined_filters.rs index 2ffb4f2..67b0c74 100644 --- a/src/filters/get_combined_filters.rs +++ b/src/filters/get_combined_filters.rs @@ -4,28 +4,36 @@ use warp::{Filter, wrap_fn, filters::BoxedFilter, reply::Response, fs::File, Rep use crate::{data::IndexedData, settings::Settings}; +/// get the combined routes / filters to handle each feature of the server pub async fn get_combined_filters(settings:&Settings, indexed_data:Arc) -> Result, Box> { - // define each "filter" (aka "route") of the server - // each filter corresponds to a feature or capability - let filter_static_folder = warp::fs::dir(settings.NLR_STATIC_HTTP.clone()); - let filter_show = warp::path("show").and(filter_static_folder); - let filter_lines = super::lines(indexed_data.clone()); - let route_points = super::points(indexed_data.clone()); - let route_lines_batch = super::lines_batch(indexed_data.clone()); - - // chain filters together into a single filter - let x = filter_show.map(|r:File| r.into_response()).or( - filter_lines - .or(route_points) + let filter_show = + warp::path("show") + .and( + warp::fs::dir(settings.NLR_STATIC_HTTP.clone()) + .map(|r:File| r.into_response()) + ); + let filter_lines = super::lines(indexed_data.clone()); + let filter_points = super::points(indexed_data.clone()); + let filter_lines_batch = super::lines_batch(indexed_data.clone()); + let filter_unified_batch = super::unified_batch(indexed_data.clone()); + + // Chain filters together into a single filter + Ok( + filter_show .or( - route_lines_batch - .with(warp::compression::gzip()) - ) - .recover(super::custom_rejection_handler) - .with(wrap_fn(super::echo_x_request_id)) - ).unify(); - Ok(x.boxed()) + filter_lines + .or(filter_points) + .or(filter_unified_batch) + .or( + filter_lines_batch + .with(warp::compression::gzip()) + ) + .recover(super::custom_rejection_handler) + .with(wrap_fn(super::echo_x_request_id)) + ).unify() + .boxed() + ) } #[cfg(test)] diff --git a/src/filters/lines.rs b/src/filters/lines.rs index 07e86e6..da0fa09 100644 --- a/src/filters/lines.rs +++ b/src/filters/lines.rs @@ -13,10 +13,31 @@ use super::{ pub fn lines( indexed_data: Arc, ) -> impl Filter + Clone { - warp::get() + warp::path::end() + .and(warp::get()) .and(with_shared_data(indexed_data.clone())) .and(warp::query()) .and_then(| + indexed_data: Arc, + query: QueryParametersLine + | async move { + if query.m { + get_linestring_m(&query, &indexed_data).map_err(|err|err.as_rejection()) + } else { + get_linestring(&query, &indexed_data).map_err(|err|err.as_rejection()) + } + }) + // New version of the endpoint must be descriminated by the `/line` route + // this new version will accept both GET and POST requests + .or( + warp::path("line") + .and(with_shared_data(indexed_data.clone())) + .and( + warp::get().and(warp::query()) + .or(warp::post().and(warp::body::json())) + .unify() + ) + .and_then(| indexed_data: Arc, query: QueryParametersLine | async move { @@ -26,4 +47,6 @@ pub fn lines( get_linestring(&query, &indexed_data).map_err(|err|err.as_rejection()) } }) -} \ No newline at end of file + ) + .unify() +} diff --git a/src/filters/mod.rs b/src/filters/mod.rs index 19f218c..4647cf7 100644 --- a/src/filters/mod.rs +++ b/src/filters/mod.rs @@ -6,13 +6,13 @@ pub use echo_x_request_id::echo_x_request_id; pub mod query_parameters; mod lines; -pub use lines::lines; +use lines::lines; mod points; -pub use points::points; +use points::points; mod lines_batch; -pub use lines_batch::lines_batch; +use lines_batch::lines_batch; mod custom_rejection_handler; pub use custom_rejection_handler::custom_rejection_handler; @@ -21,4 +21,7 @@ mod get_combined_filters; pub use get_combined_filters::get_combined_filters; mod with_shared_data; -pub use with_shared_data::with_shared_data; \ No newline at end of file +pub use with_shared_data::with_shared_data; + +mod unified_batch; +use unified_batch::unified_batch; \ No newline at end of file diff --git a/src/filters/points.rs b/src/filters/points.rs index cbd5ebf..ccc5097 100644 --- a/src/filters/points.rs +++ b/src/filters/points.rs @@ -13,13 +13,32 @@ use super::{ pub fn points( indexed_data: Arc ) -> impl Filter + Clone { - warp::get() + warp::path::end() + .and(warp::get()) .and(with_shared_data(indexed_data.clone())) .and(warp::query()) .and_then(| + indexed_data: Arc, + query: QueryParametersPoint + | async move { + get_points (&query, &indexed_data).map_err(|err|err.as_rejection()) + }) + // New version of the endpoint must be descriminated by the `/point` route + // this new version will accept both GET and POST requests + .or( + warp::path("point") + .and(with_shared_data(indexed_data.clone())) + .and( + warp::get().and(warp::query()) + .or(warp::post().and(warp::body::json())) + .unify() + ) + .and_then(| indexed_data: Arc, query: QueryParametersPoint | async move { get_points(&query, &indexed_data).map_err(|err|err.as_rejection()) }) + ) + .unify() } diff --git a/src/filters/query_parameters/mod.rs b/src/filters/query_parameters/mod.rs index 5d66c0b..a0b6c08 100644 --- a/src/filters/query_parameters/mod.rs +++ b/src/filters/query_parameters/mod.rs @@ -10,4 +10,11 @@ mod query_parameters_point; pub use query_parameters_point::QueryParametersPoint; mod query_parameters_batch; -pub use query_parameters_batch::QueryParameterBatch; \ No newline at end of file +pub use query_parameters_batch::QueryParameterBatch; + +mod query_parameters_unified; +pub use query_parameters_unified::{ + QueryParametersPointLine, + QueryParametersUnifiedPost, + QueryParametersUnifiedGet +}; \ No newline at end of file diff --git a/src/filters/query_parameters/output_format.rs b/src/filters/query_parameters/output_format.rs index fd78168..c9002d9 100644 --- a/src/filters/query_parameters/output_format.rs +++ b/src/filters/query_parameters/output_format.rs @@ -1,8 +1,9 @@ -use serde::{Deserialize}; +use serde::Deserialize; -#[derive(Debug, PartialEq, Eq, Clone, Deserialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Default, Copy)] #[allow(non_camel_case_types)] pub enum OutputFormatPoints { + #[default] geojson, wkt, json, @@ -10,22 +11,40 @@ pub enum OutputFormatPoints { latlondir, } -impl Default for OutputFormatPoints { - fn default() -> Self { - OutputFormatPoints::geojson - } +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Default)] +#[allow(non_camel_case_types)] +pub enum OutputFormatLines { + #[default] + geojson, + wkt, + json, } -#[derive(Debug, PartialEq, Eq, Clone, Deserialize)] + +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Default)] #[allow(non_camel_case_types)] -pub enum OutputFormatLines { +pub enum OutputFormatUnified { + #[default] geojson, wkt, json, } -impl Default for OutputFormatLines { - fn default() -> Self { - OutputFormatLines::geojson +impl From for OutputFormatPoints{ + fn from(value: OutputFormatUnified) -> Self { + match value { + OutputFormatUnified::geojson => OutputFormatPoints::geojson, + OutputFormatUnified::wkt => OutputFormatPoints::wkt, + OutputFormatUnified::json => OutputFormatPoints::json, + } + } +} +impl From for OutputFormatLines{ + fn from(value:OutputFormatUnified) -> Self { + match value { + OutputFormatUnified::geojson => OutputFormatLines::geojson, + OutputFormatUnified::wkt => OutputFormatLines::wkt, + OutputFormatUnified::json => OutputFormatLines::json, + } } } \ No newline at end of file diff --git a/src/filters/query_parameters/query_parameters_line.rs b/src/filters/query_parameters/query_parameters_line.rs index a3a36cb..bdc25a4 100644 --- a/src/filters/query_parameters/query_parameters_line.rs +++ b/src/filters/query_parameters/query_parameters_line.rs @@ -5,8 +5,6 @@ use crate::helpers::serde_helpers::{f32_finite_or_zero, f32_not_nan_or_fail}; use super::RequestedCwy; use super::output_format::OutputFormatLines; - - #[derive(Deserialize, Debug, PartialEq, Clone)] #[serde(deny_unknown_fields)] pub struct QueryParametersLine { @@ -43,6 +41,15 @@ pub struct QueryParametersLine { } +impl QueryParametersLine { + pub fn with_format(&self, format:&OutputFormatLines) -> Self{ + QueryParametersLine{ + f:format.clone(), + ..self.clone() + } + } +} + fn default_slk_from() -> f32 { f32::NEG_INFINITY } diff --git a/src/filters/query_parameters/query_parameters_point.rs b/src/filters/query_parameters/query_parameters_point.rs index 27ff8ec..8246e2b 100644 --- a/src/filters/query_parameters/query_parameters_point.rs +++ b/src/filters/query_parameters/query_parameters_point.rs @@ -6,7 +6,7 @@ use super::RequestedCwy; use super::output_format::OutputFormatPoints; -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Clone)] #[serde(deny_unknown_fields)] pub struct QueryParametersPoint { /// road number (eg "H001") @@ -31,6 +31,17 @@ pub struct QueryParametersPoint { } +impl QueryParametersPoint { + pub fn with_format(&self, format:&OutputFormatPoints) -> Self{ + QueryParametersPoint{ + f:format.clone(), // TODO: SHould not clone inside function i think??? + cwy:self.cwy, + offset:self.offset, + road:self.road.clone(), + slk:self.slk + } + } +} diff --git a/src/filters/query_parameters/query_parameters_unified.rs b/src/filters/query_parameters/query_parameters_unified.rs new file mode 100644 index 0000000..f6ce40c --- /dev/null +++ b/src/filters/query_parameters/query_parameters_unified.rs @@ -0,0 +1,93 @@ +use serde::Deserialize; + +use super::{ + output_format::OutputFormatUnified, + QueryParametersLine, + QueryParametersPoint +}; + +#[derive(Deserialize, Debug, PartialEq)] +#[serde(untagged)] +pub enum QueryParametersPointLine{ + Point(QueryParametersPoint), + Line(QueryParametersLine) +} + + + +#[derive(Deserialize, Debug, PartialEq)] +pub struct QueryParametersUnifiedPost{ + pub format:OutputFormatUnified, + pub items:Vec +} + +#[derive(Deserialize, Debug, PartialEq)] +pub struct QueryParametersUnifiedGet{ + pub format:OutputFormatUnified, + pub items:String +} + + +#[cfg(test)] +mod tests { + use crate::filters::query_parameters::{output_format::{OutputFormatLines, OutputFormatPoints}, RequestedCwy}; + + use super::*; + + #[test] + fn test_point_line_deserialization() { + let example_json = r#"{ + "format":"geojson", + "items":[ + { + "road":"H001", + "slk_from":10, + "slk_to":20, + "offset":10 + }, + { + "road":"H016", + "slk":10 + }, + { + "road":"H015", + "slk":10 + } + ] + } + "#; + + let result: QueryParametersUnifiedPost = serde_json::from_str(example_json).unwrap(); + + let expected = QueryParametersUnifiedPost{ + format:OutputFormatUnified::geojson, + items:vec![ + QueryParametersPointLine::Line(QueryParametersLine { + road: String::from("H001"), + slk_from: 10.0, + slk_to: 20.0, + offset: 10.0, + f: OutputFormatLines::geojson, + cwy: RequestedCwy::LRS, + m: false + }), + QueryParametersPointLine::Point(QueryParametersPoint { + road: String::from("H016"), + slk: 10.0, + cwy: RequestedCwy::LRS, + offset:0.0, + f:OutputFormatPoints::geojson + }), + QueryParametersPointLine::Point(QueryParametersPoint { + road: String::from("H015"), + slk: 10.0, + cwy: RequestedCwy::LRS, + offset:0.0, + f:OutputFormatPoints::geojson + }), + ], + }; + + assert_eq!(result, expected); + } +} \ No newline at end of file diff --git a/src/filters/query_parameters/requested_cwy.rs b/src/filters/query_parameters/requested_cwy.rs index 28021e2..6945990 100644 --- a/src/filters/query_parameters/requested_cwy.rs +++ b/src/filters/query_parameters/requested_cwy.rs @@ -1,7 +1,7 @@ use crate::data::cached::Cwy; use serde::Deserialize; -#[derive(Debug, PartialEq, Clone, Deserialize)] +#[derive(Debug, PartialEq, Clone, Deserialize, Copy)] pub enum RequestedCwy { L, R, diff --git a/src/filters/unified_batch.rs b/src/filters/unified_batch.rs new file mode 100644 index 0000000..bd7b688 --- /dev/null +++ b/src/filters/unified_batch.rs @@ -0,0 +1,95 @@ +use std::sync::Arc; + +use warp::Filter; + +use crate::{ + data::IndexedData, + filters::{ + geoprocessing::get_linestring, + query_parameters::output_format::{OutputFormatLines, OutputFormatPoints, OutputFormatUnified} + } +}; + + +use super::{ + geoprocessing::get_points, + query_parameters::{QueryParametersPointLine, QueryParametersUnifiedGet, QueryParametersUnifiedPost}, + with_shared_data +}; + + +pub fn unified_batch( + indexed_data: Arc +) -> impl Filter + Clone { + use QueryParametersPointLine::*; + warp::path("batch2").and(warp::path::end()) + .and( + warp::post() + .and(with_shared_data(indexed_data.clone())) + .and(warp::body::json()) + .and_then(| + indexed_data: Arc, + query: QueryParametersUnifiedPost, + | async move { + // TODO: must not be used with non JSON return types... or those must be handled differently? + // todo: could slap rayon in here for some easy parallelization perhaps? + let QueryParametersUnifiedPost{ + format, + items + } = query; + let results:Vec = items.iter().map(|request| match request { + Point(point_request) => { + let format:OutputFormatPoints = format.clone().into(); + get_points(&point_request.with_format(&format), &indexed_data).unwrap_or("null".to_owned()) + }, + Line (line_request) =>{ + let format:OutputFormatLines = format.clone().into(); + get_linestring(&line_request.with_format(&format), &indexed_data).unwrap_or("null".to_owned()) + }, + }).collect(); + Ok::(format!("[{}]",results.join(","))) + }) + ).or( + warp::get() + .and(with_shared_data(indexed_data.clone())) + .and(warp::query()) + .and_then(| + indexed_data: Arc, + query: QueryParametersUnifiedGet, + | async move { + let QueryParametersUnifiedGet{ + format, + items + } = query; + let query:Result, _> = serde_json::from_str(items.as_str()); + match query { + Ok(items)=>{ + let results = items.iter().map(|request| match request { + Point(point_request) => { + let format:OutputFormatPoints = format.clone().into(); + get_points(&point_request.with_format(&format), &indexed_data).unwrap_or("null".to_owned()) + }, + Line (line_request) =>{ + let format:OutputFormatLines = format.clone().into(); + get_linestring(&line_request.with_format(&format), &indexed_data).unwrap_or("null".to_owned()) + }, + }); + let results:Vec = if format==OutputFormatUnified::wkt { + results.map(|item| match item.as_str(){ + "null" => item, + item => format!(r#""{}""#, item) + }).collect() + }else{ + results.collect() + }; + Ok::(format!("[{}]",results.join(","))) + }, + Err(_)=>Err(warp::reject()) // TODO: Add custom rejection + } + }) + ) + .unify() + +} + + diff --git a/tests/manual tests.ipynb b/tests/manual tests.ipynb new file mode 100644 index 0000000..8081dd1 --- /dev/null +++ b/tests/manual tests.ipynb @@ -0,0 +1,321 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "import aiohttp\n", + "from urllib.parse import urlencode\n", + "import json" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# GET Point" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "OLD ENDPOINT\n" + ] + }, + { + "ename": "ClientConnectorError", + "evalue": "Cannot connect to host 127.0.0.1:8080 ssl:default [Connect call failed ('127.0.0.1', 8080)]", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mConnectionRefusedError\u001b[0m Traceback (most recent call last)", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/connector.py:1025\u001b[0m, in \u001b[0;36mTCPConnector._wrap_create_connection\u001b[0;34m(self, req, timeout, client_error, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1022\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m ceil_timeout(\n\u001b[1;32m 1023\u001b[0m timeout\u001b[38;5;241m.\u001b[39msock_connect, ceil_threshold\u001b[38;5;241m=\u001b[39mtimeout\u001b[38;5;241m.\u001b[39mceil_threshold\n\u001b[1;32m 1024\u001b[0m ):\n\u001b[0;32m-> 1025\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_loop\u001b[38;5;241m.\u001b[39mcreate_connection(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 1026\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m cert_errors \u001b[38;5;28;01mas\u001b[39;00m exc:\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/asyncio/base_events.py:1076\u001b[0m, in \u001b[0;36mBaseEventLoop.create_connection\u001b[0;34m(self, protocol_factory, host, port, ssl, family, proto, flags, sock, local_addr, server_hostname, ssl_handshake_timeout, happy_eyeballs_delay, interleave)\u001b[0m\n\u001b[1;32m 1075\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(exceptions) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[0;32m-> 1076\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exceptions[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1077\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1078\u001b[0m \u001b[38;5;66;03m# If they all have the same str(), raise one.\u001b[39;00m\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/asyncio/base_events.py:1060\u001b[0m, in \u001b[0;36mBaseEventLoop.create_connection\u001b[0;34m(self, protocol_factory, host, port, ssl, family, proto, flags, sock, local_addr, server_hostname, ssl_handshake_timeout, happy_eyeballs_delay, interleave)\u001b[0m\n\u001b[1;32m 1059\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1060\u001b[0m sock \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connect_sock(\n\u001b[1;32m 1061\u001b[0m exceptions, addrinfo, laddr_infos)\n\u001b[1;32m 1062\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/asyncio/base_events.py:969\u001b[0m, in \u001b[0;36mBaseEventLoop._connect_sock\u001b[0;34m(self, exceptions, addr_info, local_addr_infos)\u001b[0m\n\u001b[1;32m 968\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mno matching local address with \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfamily\u001b[38;5;132;01m=}\u001b[39;00m\u001b[38;5;124m found\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 969\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock_connect(sock, address)\n\u001b[1;32m 970\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m sock\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/asyncio/selector_events.py:501\u001b[0m, in \u001b[0;36mBaseSelectorEventLoop.sock_connect\u001b[0;34m(self, sock, address)\u001b[0m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 501\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m fut\n\u001b[1;32m 502\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m 503\u001b[0m \u001b[38;5;66;03m# Needed to break cycles when an exception occurs.\u001b[39;00m\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/asyncio/selector_events.py:541\u001b[0m, in \u001b[0;36mBaseSelectorEventLoop._sock_connect_cb\u001b[0;34m(self, fut, sock, address)\u001b[0m\n\u001b[1;32m 539\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m err \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 540\u001b[0m \u001b[38;5;66;03m# Jump to any except clause below.\u001b[39;00m\n\u001b[0;32m--> 541\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(err, \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mConnect call failed \u001b[39m\u001b[38;5;132;01m{\u001b[39;00maddress\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 542\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (\u001b[38;5;167;01mBlockingIOError\u001b[39;00m, \u001b[38;5;167;01mInterruptedError\u001b[39;00m):\n\u001b[1;32m 543\u001b[0m \u001b[38;5;66;03m# socket is still registered, the callback will be retried later\u001b[39;00m\n", + "\u001b[0;31mConnectionRefusedError\u001b[0m: [Errno 111] Connect call failed ('127.0.0.1', 8080)", + "\nThe above exception was the direct cause of the following exception:\n", + "\u001b[0;31mClientConnectorError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[7], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m aiohttp\u001b[38;5;241m.\u001b[39mClientSession() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOLD ENDPOINT\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m session\u001b[38;5;241m.\u001b[39mget(\n\u001b[1;32m 4\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttp://127.0.0.1:8080/?road=H001&slk=10\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 5\u001b[0m ) \u001b[38;5;28;01mas\u001b[39;00m resp:\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstatus)\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;01mawait\u001b[39;00m resp\u001b[38;5;241m.\u001b[39mtext())\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/client.py:1197\u001b[0m, in \u001b[0;36m_BaseRequestContextManager.__aenter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1196\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__aenter__\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m _RetType:\n\u001b[0;32m-> 1197\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_coro\n\u001b[1;32m 1198\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_resp\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/client.py:581\u001b[0m, in \u001b[0;36mClientSession._request\u001b[0;34m(self, method, str_or_url, params, data, json, cookies, headers, skip_auto_headers, auth, allow_redirects, max_redirects, compress, chunked, expect100, raise_for_status, read_until_eof, proxy, proxy_auth, timeout, verify_ssl, fingerprint, ssl_context, ssl, server_hostname, proxy_headers, trace_request_ctx, read_bufsize, auto_decompress, max_line_size, max_field_size)\u001b[0m\n\u001b[1;32m 576\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m ceil_timeout(\n\u001b[1;32m 577\u001b[0m real_timeout\u001b[38;5;241m.\u001b[39mconnect,\n\u001b[1;32m 578\u001b[0m ceil_threshold\u001b[38;5;241m=\u001b[39mreal_timeout\u001b[38;5;241m.\u001b[39mceil_threshold,\n\u001b[1;32m 579\u001b[0m ):\n\u001b[1;32m 580\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connector \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 581\u001b[0m conn \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connector\u001b[38;5;241m.\u001b[39mconnect(\n\u001b[1;32m 582\u001b[0m req, traces\u001b[38;5;241m=\u001b[39mtraces, timeout\u001b[38;5;241m=\u001b[39mreal_timeout\n\u001b[1;32m 583\u001b[0m )\n\u001b[1;32m 584\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mTimeoutError \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 585\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ServerTimeoutError(\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection timeout \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mto host \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(url)\n\u001b[1;32m 587\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/connector.py:544\u001b[0m, in \u001b[0;36mBaseConnector.connect\u001b[0;34m(self, req, traces, timeout)\u001b[0m\n\u001b[1;32m 541\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m trace\u001b[38;5;241m.\u001b[39msend_connection_create_start()\n\u001b[1;32m 543\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 544\u001b[0m proto \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_create_connection(req, traces, timeout)\n\u001b[1;32m 545\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_closed:\n\u001b[1;32m 546\u001b[0m proto\u001b[38;5;241m.\u001b[39mclose()\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/connector.py:944\u001b[0m, in \u001b[0;36mTCPConnector._create_connection\u001b[0;34m(self, req, traces, timeout)\u001b[0m\n\u001b[1;32m 942\u001b[0m _, proto \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_create_proxy_connection(req, traces, timeout)\n\u001b[1;32m 943\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 944\u001b[0m _, proto \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_create_direct_connection(req, traces, timeout)\n\u001b[1;32m 946\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m proto\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/connector.py:1257\u001b[0m, in \u001b[0;36mTCPConnector._create_direct_connection\u001b[0;34m(self, req, traces, timeout, client_error)\u001b[0m\n\u001b[1;32m 1255\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1256\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m last_exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m-> 1257\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m last_exc\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/connector.py:1226\u001b[0m, in \u001b[0;36mTCPConnector._create_direct_connection\u001b[0;34m(self, req, traces, timeout, client_error)\u001b[0m\n\u001b[1;32m 1219\u001b[0m server_hostname \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 1220\u001b[0m (req\u001b[38;5;241m.\u001b[39mserver_hostname \u001b[38;5;129;01mor\u001b[39;00m hinfo[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhostname\u001b[39m\u001b[38;5;124m\"\u001b[39m])\u001b[38;5;241m.\u001b[39mrstrip(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 1221\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m sslcontext\n\u001b[1;32m 1222\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1223\u001b[0m )\n\u001b[1;32m 1225\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1226\u001b[0m transp, proto \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_wrap_create_connection(\n\u001b[1;32m 1227\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_factory,\n\u001b[1;32m 1228\u001b[0m host,\n\u001b[1;32m 1229\u001b[0m port,\n\u001b[1;32m 1230\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout,\n\u001b[1;32m 1231\u001b[0m ssl\u001b[38;5;241m=\u001b[39msslcontext,\n\u001b[1;32m 1232\u001b[0m family\u001b[38;5;241m=\u001b[39mhinfo[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfamily\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 1233\u001b[0m proto\u001b[38;5;241m=\u001b[39mhinfo[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mproto\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 1234\u001b[0m flags\u001b[38;5;241m=\u001b[39mhinfo[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mflags\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 1235\u001b[0m server_hostname\u001b[38;5;241m=\u001b[39mserver_hostname,\n\u001b[1;32m 1236\u001b[0m local_addr\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_local_addr,\n\u001b[1;32m 1237\u001b[0m req\u001b[38;5;241m=\u001b[39mreq,\n\u001b[1;32m 1238\u001b[0m client_error\u001b[38;5;241m=\u001b[39mclient_error,\n\u001b[1;32m 1239\u001b[0m )\n\u001b[1;32m 1240\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ClientConnectorError \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 1241\u001b[0m last_exc \u001b[38;5;241m=\u001b[39m exc\n", + "File \u001b[0;32m~/.python/current/lib/python3.10/site-packages/aiohttp/connector.py:1033\u001b[0m, in \u001b[0;36mTCPConnector._wrap_create_connection\u001b[0;34m(self, req, timeout, client_error, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1031\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m exc\u001b[38;5;241m.\u001b[39merrno \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(exc, asyncio\u001b[38;5;241m.\u001b[39mTimeoutError):\n\u001b[1;32m 1032\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[0;32m-> 1033\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m client_error(req\u001b[38;5;241m.\u001b[39mconnection_key, exc) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n", + "\u001b[0;31mClientConnectorError\u001b[0m: Cannot connect to host 127.0.0.1:8080 ssl:default [Connect call failed ('127.0.0.1', 8080)]" + ] + } + ], + "source": [ + "async with aiohttp.ClientSession() as session:\n", + " print(\"OLD ENDPOINT\")\n", + " async with session.get(\n", + " 'http://127.0.0.1:8080/?road=H001&slk=10',\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())\n", + " print(\"NEW ENDPOINT\")\n", + " async with session.get(\n", + " 'http://127.0.0.1:8080/point?road=H001&slk=10',\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# POST Point" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n", + "{\"type\":\"Feature\", \"geometry\":{\"type\":\"MultiPoint\", \"coordinates\":[[115.94760912079117,-32.02715491861322],[115.94757850364783,-32.027310605645496]]}}\n" + ] + } + ], + "source": [ + "async with aiohttp.ClientSession() as session:\n", + " async with session.post(\n", + " 'http://127.0.0.1:8080/point',\n", + " json={\n", + " \"road\":\"H001\",\n", + " \"slk\":10\n", + " }\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# GET Line" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n", + "{\"type\":\"Feature\", \"geometry\":{\"type\":\"MultiLineString\", \"coordinates\":[[[115.94760912079117,-32.02715491861322],[115.94916542600002,-32.02740658715116],[115.94938048800007,-32.027437011151164]],[[115.94938048800007,-32.027437011151164],[115.94982457900008,-32.02749788315117],[115.950541895,-32.02761572915117],[115.95055200500006,-32.02766424715116]],[[115.95905179400006,-32.02881369215116],[115.95907661600006,-32.02878179815113],[115.95942546100002,-32.028832049151134]],[[115.959425387,-32.028832049151134],[115.95980428000009,-32.028888346151156],[115.96014705800008,-32.02894046715118]],[[115.96014705800008,-32.02894046715118],[115.96037288700006,-32.02897643615117],[115.96058206900013,-32.02902282415115],[115.9607771540001,-32.02907502215116],[115.96098600300002,-32.02914519515114],[115.96120853600009,-32.02924529415113],[115.96140999300007,-32.029354106151146],[115.96159726000008,-32.02948364115111],[115.96176008100008,-32.02960703915115],[115.96281308400012,-32.03055790315115]],[[115.962813094,-32.03055793015113],[115.966291812,-32.03358549015107],[115.9665753380001,-32.033853527151045],[115.96685248500012,-32.03413526915107],[115.96706060100009,-32.03437316515109]],[[115.96706060100009,-32.03437316515109],[115.96718390800004,-32.03451986015108],[115.9672888990001,-32.034656754151065],[115.96740242300008,-32.03481648615105],[115.96855902400011,-32.03654736515105]],[[115.96855902400011,-32.03654736515105],[115.96903512300004,-32.03726321115106],[115.96900246000008,-32.03731250715103]],[[115.98602541900004,-32.05258774015082],[115.98607212600008,-32.0525757181508],[115.98708941700012,-32.05353300015079]],[[115.98708942800008,-32.05353300015079],[115.98810661100002,-32.05449429515079],[115.98843986800011,-32.05478457615079],[115.98875006800006,-32.055043963150744],[115.989514524,-32.05560608615075]],[[115.989514524,-32.05560606815077],[115.99134687100003,-32.05695636615072]],[[115.99134687100003,-32.05695636615072],[115.99381280700004,-32.058699676150695]],[[115.99381289200004,-32.058699659150705],[115.99441266100008,-32.059123649150706],[115.9945951860001,-32.05925382815069],[115.9947754010001,-32.05938709215069],[115.99503909100008,-32.05959003015072],[115.99529995800005,-32.059800323150725],[115.99555715500004,-32.06001406915071],[115.99580836400004,-32.060233974150705],[115.99630754400005,-32.06068059515067]],[[115.99630754400005,-32.06068059515067],[115.99815077500013,-32.062335660150666],[115.99839667700007,-32.06255859415069],[115.998523781,-32.06267885815066],[115.998608321,-32.06276411715067],[115.99869894800008,-32.06286428215065],[115.99878241800002,-32.06296514815069],[115.99885250300008,-32.06306248915063],[115.99891497700004,-32.063159383150655],[115.99896370900002,-32.063245874150645],[115.99904510300009,-32.06341379615065],[115.99909362600012,-32.06354368615064]],[[115.99909362600012,-32.06354368615064],[115.9991384650001,-32.06370261315066],[115.99917329000004,-32.0638598471506],[115.99922032200004,-32.06408977915065],[115.99924385700002,-32.0642400041506],[115.99926947400002,-32.06442273915061],[115.999289448,-32.0646012891506],[115.99931340900004,-32.064936126150606],[115.999323816,-32.06524805015064],[115.99931702600009,-32.065572964150626],[115.99926763700012,-32.06630549515064],[115.99916365800006,-32.067651580150574],[115.99915670200004,-32.06784374715059],[115.99916337300009,-32.06805122215056],[115.999190386,-32.068254717150545],[115.99922602900004,-32.068423558150556],[115.9992799370001,-32.0686059851506],[115.99934952300008,-32.06875937015056]],[[115.99934952300008,-32.06875937015056],[115.99940124300008,-32.06887521215056],[115.9994648390001,-32.06900086415058],[115.99960203700005,-32.06922735815057],[115.99967389800008,-32.06933924615057],[115.9997626940001,-32.069462327150546],[115.99987420600009,-32.06958628215058],[115.99998502600008,-32.06969985815057],[116.00016342500008,-32.069872053150576],[116.00021068100013,-32.069993282150584]],[[116.00975369600006,-32.07969769715041],[116.00979730200004,-32.07969029815039],[116.00982930400004,-32.07973029515045],[116.00987000100008,-32.079787302150386],[116.0099089040001,-32.07984269815044],[116.00994780500002,-32.079901197150406],[116.00999739600002,-32.07997360015039],[116.01041270000007,-32.080704000150405]],[[116.01041270000007,-32.080704000150405],[116.01044699700002,-32.080768002150386],[116.01054809800009,-32.080950197150415],[116.01064220500004,-32.08112949615039],[116.010728803,-32.081314500150384],[116.01081549900005,-32.08151990215038],[116.01085559700005,-32.08163559515038],[116.01090119900005,-32.0817765001504],[116.01093820200003,-32.08189720315039],[116.01096070100004,-32.081977495150404]],[[116.01096080500008,-32.08197770315037],[116.01098630100012,-32.0820757991504],[116.01102020100006,-32.082219102150376],[116.01111889600008,-32.082767598150376],[116.01119340000004,-32.083201103150365],[116.01121570300006,-32.08333609715037],[116.01130579800008,-32.08379000215034]],[[116.01130379600012,-32.08378989715036],[116.0114799050001,-32.08453269715038],[116.01154370000006,-32.084843097150355],[116.01160790500002,-32.085135196150325]],[[116.01160789800008,-32.08513680215034],[116.01195439800006,-32.08680920315032],[116.01200370400012,-32.08709369815034],[116.01205790300004,-32.08744639415033],[116.01211789600008,-32.08775689915028],[116.01217820500004,-32.08805789915031],[116.01228280200009,-32.088499197150306]],[[116.01228282300008,-32.088499197150306],[116.012352211,-32.08880140315031],[116.01238661700006,-32.08894731715028],[116.01244182000003,-32.089198985150254],[116.012566891,-32.08980302015028],[116.01268142000004,-32.090287715150296],[116.01270697354565,-32.09043705015277]],[[115.94757850364783,-32.027310605645496],[115.948913112,-32.02750497315115],[115.94937052700004,-32.02756565915116]],[[115.94937051600004,-32.02756564115117],[115.95009374100006,-32.02766214015115],[115.95030801100008,-32.02768684615119],[115.95053346600002,-32.02770857615114],[115.95055200500006,-32.02766424715116]],[[115.95905179400006,-32.02881369215116],[115.95906868500002,-32.02885671715113],[115.9593894930001,-32.02890560115114]],[[115.95938950400011,-32.02890561015116],[115.96023942300008,-32.02903491815117],[115.96043120300013,-32.02907218715112],[115.96060898200004,-32.029112344151116],[115.96078318800004,-32.029161404151154],[115.96093973800008,-32.02921924915118],[115.9610857900001,-32.02928298915114],[115.96122478600012,-32.029355557151156],[115.96136008700012,-32.02944299815115],[115.96149869400008,-32.029545368151126],[115.96271654100008,-32.030637356151104]],[[115.96271653100008,-32.03063734715112],[115.96627545500006,-32.03373869815109],[115.9665317690001,-32.033991304151094],[115.96674438200012,-32.034216282151085],[115.96695983200004,-32.034457377151064]],[[115.96695983200004,-32.034457377151064],[115.96709750000002,-32.03462953915107],[115.96724616100003,-32.034824253151044],[115.96741046400008,-32.03504933315104],[115.967825283,-32.03566972815104]],[[115.96782530400002,-32.035669719151024],[115.96846357700008,-32.03664513515102]],[[115.96846357700008,-32.03664513515102],[115.96893467600012,-32.037318550151014],[115.96900246000008,-32.03731250715103]],[[115.98602541900004,-32.05258774015082],[115.98600267400002,-32.052629307150795],[115.986162431,-32.052815383150836],[115.98632059100008,-32.052992587150776],[115.98698481300003,-32.05362177915079]],[[115.98698481300003,-32.05362177915079],[115.98776396900008,-32.05436768215078],[115.98789670500004,-32.054488849150815],[115.98802325400004,-32.054597580150755],[115.98839285300004,-32.054918850150784],[115.98857267500011,-32.05507270615078],[115.98875951700006,-32.055220158150746],[115.98940679300009,-32.05569496915074]],[[115.98940690000006,-32.055694916150784],[115.99130558000004,-32.05708669015073]],[[115.99130558000004,-32.05708669015073],[115.9937186520001,-32.05879192815069]],[[115.9937186730001,-32.05879193715072],[115.99470242200005,-32.059482282150704],[115.99489488600013,-32.05961913415067],[115.99498831700008,-32.0596947051507],[115.99507624700004,-32.05977256915069],[115.99619786000008,-32.06077486315067]],[[115.99619786000008,-32.06077486315067],[115.99807211200005,-32.062450870150656],[115.99824467900008,-32.062609373150686],[115.99840962100008,-32.06276674215064],[115.99852777700004,-32.06288769215064],[115.99863907800012,-32.063020416150664],[115.99874097300004,-32.06315495915066],[115.99882580100008,-32.06329546515063],[115.99890164200006,-32.06343932915064],[115.99895604600012,-32.06358071415064]],[[115.99895604600012,-32.06358071415064],[115.99899091800012,-32.06368208915061],[115.99902222500008,-32.063788821150624],[115.99907593100008,-32.06400220715067],[115.99912074900011,-32.064210678150666],[115.99915577200012,-32.06442461115066],[115.9991818960001,-32.06463570415061],[115.99919663600008,-32.064847392150654],[115.99920328500002,-32.06505695115063],[115.99920165300011,-32.065281654150645],[115.99918984500006,-32.06548553815062],[115.99903926500008,-32.06751714815059],[115.999024856,-32.06772239115058],[115.99902083700012,-32.067941545150546],[115.99903161300006,-32.06814560715057],[115.99906674800005,-32.06834847115059],[115.99912209200012,-32.06856048015058],[115.99919450800007,-32.068759445150555]],[[115.99919450800007,-32.068759445150555],[115.99926036200009,-32.068912133150576],[115.9993598840001,-32.06909407215058],[115.9994460920001,-32.06923096215055],[115.99954764200004,-32.06937558715057],[115.99965180200002,-32.06950432015055],[115.99976726800004,-32.06963868115056],[115.99988615800008,-32.06975647015054],[116.000079045,-32.06993983915055],[116.00021068100013,-32.069993282150584]],[[116.00975369600006,-32.07969769715041],[116.00972690500008,-32.07972970215041],[116.00974449500006,-32.07975409715043],[116.00978869900008,-32.079821903150425],[116.00981339900012,-32.07986500015044],[116.00984519900008,-32.0799158031504],[116.0099140980001,-32.08003410315039],[116.01044200300012,-32.08108199715039],[116.01060730400005,-32.08142149815036],[116.01066479800012,-32.08155120115038],[116.01071630300008,-32.081699802150375],[116.01076789700004,-32.081872598150376],[116.0108100010001,-32.082039195150415]],[[116.0108100010001,-32.082039195150415],[116.01086680000004,-32.08229049815037],[116.01117879500008,-32.083817500150346]],[[116.01117879500008,-32.083817500150346],[116.01145920200008,-32.08515750015036]],[[116.0114591990001,-32.085155795150364],[116.01153080000006,-32.08550010315032],[116.01165300500008,-32.086095700150345],[116.01180209700011,-32.08683479815032],[116.01189579600008,-32.087381703150285],[116.01197119800008,-32.08781220015031],[116.01205969700004,-32.088292001150286],[116.01211020000004,-32.088533195150305]],[[116.01211020500013,-32.088533710150315],[116.01221158900012,-32.089003913150265],[116.01231180800004,-32.0894001791503],[116.0124084040001,-32.08979348615026],[116.01246047600011,-32.089992455150266],[116.01254258900008,-32.090340281150254],[116.01256533516806,-32.09046098461943]],[[115.95055200500006,-32.02766424715116],[115.95075652600008,-32.02768307015118],[115.95096309300004,-32.027705456151175],[115.95186319500012,-32.02780944315116]],[[115.95186329100012,-32.02780944315116],[115.95464018800013,-32.02818988215117]],[[115.9546401770001,-32.02818988215117],[115.95777842900009,-32.02861851615117]],[[115.95777845000008,-32.02861852515115],[115.95905179400006,-32.02881369215116]],[[115.96900255500007,-32.037312508151004],[115.97046105000004,-32.039483618150996]],[[115.97046099800002,-32.039483600151016],[115.97184500100002,-32.04154269715095]],[[115.97184500100002,-32.04154269715095],[115.97280010500002,-32.04292509415091],[115.9733682000001,-32.04376440215094]],[[115.9733682000001,-32.04376440215094],[115.97339000500008,-32.043798796150945],[115.97381259800008,-32.04442810215093]],[[115.97381259800008,-32.04442810215093],[115.97430980200012,-32.045168600150895],[115.97443690200008,-32.045364999150905],[115.97464689500008,-32.04572159715088],[115.97500619500008,-32.04627529615091],[115.97521469700008,-32.046561796150904],[115.97525139800008,-32.04661109615092]],[[115.97525139800008,-32.04661109615092],[115.97527640400008,-32.04664630015088],[115.97539260400004,-32.046804197150905],[115.97560679700008,-32.04708300315088],[115.97568210300004,-32.04717339815091],[115.97585690300002,-32.04737169615088],[115.97600410400004,-32.047527895150886],[115.97612110400009,-32.04763889815084],[115.97618919800004,-32.0476978961509],[115.97639590000006,-32.04786599615089],[115.97652749500004,-32.047965596150874],[115.97665199700008,-32.04805549515087],[115.97676800400008,-32.048131099150886],[115.9770220040001,-32.04828459615088],[115.9771674970001,-32.04836429815086],[115.97729429800006,-32.04842849615088],[115.97757290200002,-32.04856219915085]],[[115.97757290200002,-32.04856219915085],[115.977684704,-32.048612203150846],[115.97778879900012,-32.04865429615083],[115.97898049700008,-32.04909250215083],[115.980413998,-32.04965890215086]],[[115.980413998,-32.04965890215086],[115.98152059800007,-32.05009089815083]],[[115.98152059800007,-32.05009089815083],[115.98294270200006,-32.05064769715086]],[[115.98294270200006,-32.05064769715086],[115.98317380300011,-32.050736496150826],[115.98341090200005,-32.050834698150815],[115.983666502,-32.05094390115085],[115.98375919600004,-32.05099350215085],[115.983903101,-32.05107499815087],[115.98397830100012,-32.05111849615082]],[[115.98397834300012,-32.051118506150836],[115.98424921800007,-32.05127562315083],[115.98521477000008,-32.05185905815085],[115.98537990400006,-32.05196834415083],[115.98558031000005,-32.0521353511508],[115.98576371700004,-32.05231002415079],[115.98602541900004,-32.05258774015082]],[[116.00021070200012,-32.069993300150564],[116.00058170400008,-32.07034699415056],[116.00082140400004,-32.07059039815057],[116.00091009900008,-32.07068409615056],[116.00213860100008,-32.071865095150535],[116.00217830100009,-32.07190099615051],[116.00221699800012,-32.07193849515055],[116.00232459800009,-32.072037898150526]],[[116.00232459800009,-32.072037898150526],[116.00244300200006,-32.072142401150494],[116.00260530000004,-32.07227130015051],[116.00387460400007,-32.07326170015053],[116.00476389800008,-32.07394209515049]],[[116.00476389800008,-32.07394209515049],[116.00538499700008,-32.07442950315049],[116.005478905,-32.0745210011505],[116.006703495,-32.07599550015048]],[[116.00670348500012,-32.075995491150465],[116.00826297600008,-32.07787431015045],[116.00854813800004,-32.07822076015043]],[[116.00854813800004,-32.07822076015043],[116.00921988800008,-32.07903830315041],[116.009371804,-32.07921229015045],[116.00952440000005,-32.07940188915038],[116.00966849100008,-32.079584294150415],[116.00975367500006,-32.07969767915045]]]}}\n", + "NEW LINE API\n", + "200\n", + "{\"type\":\"Feature\", \"geometry\":{\"type\":\"MultiLineString\", \"coordinates\":[[[115.94760912079117,-32.02715491861322],[115.94916542600002,-32.02740658715116],[115.94938048800007,-32.027437011151164]],[[115.94938048800007,-32.027437011151164],[115.94982457900008,-32.02749788315117],[115.950541895,-32.02761572915117],[115.95055200500006,-32.02766424715116]],[[115.95905179400006,-32.02881369215116],[115.95907661600006,-32.02878179815113],[115.95942546100002,-32.028832049151134]],[[115.959425387,-32.028832049151134],[115.95980428000009,-32.028888346151156],[115.96014705800008,-32.02894046715118]],[[115.96014705800008,-32.02894046715118],[115.96037288700006,-32.02897643615117],[115.96058206900013,-32.02902282415115],[115.9607771540001,-32.02907502215116],[115.96098600300002,-32.02914519515114],[115.96120853600009,-32.02924529415113],[115.96140999300007,-32.029354106151146],[115.96159726000008,-32.02948364115111],[115.96176008100008,-32.02960703915115],[115.96281308400012,-32.03055790315115]],[[115.962813094,-32.03055793015113],[115.966291812,-32.03358549015107],[115.9665753380001,-32.033853527151045],[115.96685248500012,-32.03413526915107],[115.96706060100009,-32.03437316515109]],[[115.96706060100009,-32.03437316515109],[115.96718390800004,-32.03451986015108],[115.9672888990001,-32.034656754151065],[115.96740242300008,-32.03481648615105],[115.96855902400011,-32.03654736515105]],[[115.96855902400011,-32.03654736515105],[115.96903512300004,-32.03726321115106],[115.96900246000008,-32.03731250715103]],[[115.98602541900004,-32.05258774015082],[115.98607212600008,-32.0525757181508],[115.98708941700012,-32.05353300015079]],[[115.98708942800008,-32.05353300015079],[115.98810661100002,-32.05449429515079],[115.98843986800011,-32.05478457615079],[115.98875006800006,-32.055043963150744],[115.989514524,-32.05560608615075]],[[115.989514524,-32.05560606815077],[115.99134687100003,-32.05695636615072]],[[115.99134687100003,-32.05695636615072],[115.99381280700004,-32.058699676150695]],[[115.99381289200004,-32.058699659150705],[115.99441266100008,-32.059123649150706],[115.9945951860001,-32.05925382815069],[115.9947754010001,-32.05938709215069],[115.99503909100008,-32.05959003015072],[115.99529995800005,-32.059800323150725],[115.99555715500004,-32.06001406915071],[115.99580836400004,-32.060233974150705],[115.99630754400005,-32.06068059515067]],[[115.99630754400005,-32.06068059515067],[115.99815077500013,-32.062335660150666],[115.99839667700007,-32.06255859415069],[115.998523781,-32.06267885815066],[115.998608321,-32.06276411715067],[115.99869894800008,-32.06286428215065],[115.99878241800002,-32.06296514815069],[115.99885250300008,-32.06306248915063],[115.99891497700004,-32.063159383150655],[115.99896370900002,-32.063245874150645],[115.99904510300009,-32.06341379615065],[115.99909362600012,-32.06354368615064]],[[115.99909362600012,-32.06354368615064],[115.9991384650001,-32.06370261315066],[115.99917329000004,-32.0638598471506],[115.99922032200004,-32.06408977915065],[115.99924385700002,-32.0642400041506],[115.99926947400002,-32.06442273915061],[115.999289448,-32.0646012891506],[115.99931340900004,-32.064936126150606],[115.999323816,-32.06524805015064],[115.99931702600009,-32.065572964150626],[115.99926763700012,-32.06630549515064],[115.99916365800006,-32.067651580150574],[115.99915670200004,-32.06784374715059],[115.99916337300009,-32.06805122215056],[115.999190386,-32.068254717150545],[115.99922602900004,-32.068423558150556],[115.9992799370001,-32.0686059851506],[115.99934952300008,-32.06875937015056]],[[115.99934952300008,-32.06875937015056],[115.99940124300008,-32.06887521215056],[115.9994648390001,-32.06900086415058],[115.99960203700005,-32.06922735815057],[115.99967389800008,-32.06933924615057],[115.9997626940001,-32.069462327150546],[115.99987420600009,-32.06958628215058],[115.99998502600008,-32.06969985815057],[116.00016342500008,-32.069872053150576],[116.00021068100013,-32.069993282150584]],[[116.00975369600006,-32.07969769715041],[116.00979730200004,-32.07969029815039],[116.00982930400004,-32.07973029515045],[116.00987000100008,-32.079787302150386],[116.0099089040001,-32.07984269815044],[116.00994780500002,-32.079901197150406],[116.00999739600002,-32.07997360015039],[116.01041270000007,-32.080704000150405]],[[116.01041270000007,-32.080704000150405],[116.01044699700002,-32.080768002150386],[116.01054809800009,-32.080950197150415],[116.01064220500004,-32.08112949615039],[116.010728803,-32.081314500150384],[116.01081549900005,-32.08151990215038],[116.01085559700005,-32.08163559515038],[116.01090119900005,-32.0817765001504],[116.01093820200003,-32.08189720315039],[116.01096070100004,-32.081977495150404]],[[116.01096080500008,-32.08197770315037],[116.01098630100012,-32.0820757991504],[116.01102020100006,-32.082219102150376],[116.01111889600008,-32.082767598150376],[116.01119340000004,-32.083201103150365],[116.01121570300006,-32.08333609715037],[116.01130579800008,-32.08379000215034]],[[116.01130379600012,-32.08378989715036],[116.0114799050001,-32.08453269715038],[116.01154370000006,-32.084843097150355],[116.01160790500002,-32.085135196150325]],[[116.01160789800008,-32.08513680215034],[116.01195439800006,-32.08680920315032],[116.01200370400012,-32.08709369815034],[116.01205790300004,-32.08744639415033],[116.01211789600008,-32.08775689915028],[116.01217820500004,-32.08805789915031],[116.01228280200009,-32.088499197150306]],[[116.01228282300008,-32.088499197150306],[116.012352211,-32.08880140315031],[116.01238661700006,-32.08894731715028],[116.01244182000003,-32.089198985150254],[116.012566891,-32.08980302015028],[116.01268142000004,-32.090287715150296],[116.01270697354565,-32.09043705015277]],[[115.94757850364783,-32.027310605645496],[115.948913112,-32.02750497315115],[115.94937052700004,-32.02756565915116]],[[115.94937051600004,-32.02756564115117],[115.95009374100006,-32.02766214015115],[115.95030801100008,-32.02768684615119],[115.95053346600002,-32.02770857615114],[115.95055200500006,-32.02766424715116]],[[115.95905179400006,-32.02881369215116],[115.95906868500002,-32.02885671715113],[115.9593894930001,-32.02890560115114]],[[115.95938950400011,-32.02890561015116],[115.96023942300008,-32.02903491815117],[115.96043120300013,-32.02907218715112],[115.96060898200004,-32.029112344151116],[115.96078318800004,-32.029161404151154],[115.96093973800008,-32.02921924915118],[115.9610857900001,-32.02928298915114],[115.96122478600012,-32.029355557151156],[115.96136008700012,-32.02944299815115],[115.96149869400008,-32.029545368151126],[115.96271654100008,-32.030637356151104]],[[115.96271653100008,-32.03063734715112],[115.96627545500006,-32.03373869815109],[115.9665317690001,-32.033991304151094],[115.96674438200012,-32.034216282151085],[115.96695983200004,-32.034457377151064]],[[115.96695983200004,-32.034457377151064],[115.96709750000002,-32.03462953915107],[115.96724616100003,-32.034824253151044],[115.96741046400008,-32.03504933315104],[115.967825283,-32.03566972815104]],[[115.96782530400002,-32.035669719151024],[115.96846357700008,-32.03664513515102]],[[115.96846357700008,-32.03664513515102],[115.96893467600012,-32.037318550151014],[115.96900246000008,-32.03731250715103]],[[115.98602541900004,-32.05258774015082],[115.98600267400002,-32.052629307150795],[115.986162431,-32.052815383150836],[115.98632059100008,-32.052992587150776],[115.98698481300003,-32.05362177915079]],[[115.98698481300003,-32.05362177915079],[115.98776396900008,-32.05436768215078],[115.98789670500004,-32.054488849150815],[115.98802325400004,-32.054597580150755],[115.98839285300004,-32.054918850150784],[115.98857267500011,-32.05507270615078],[115.98875951700006,-32.055220158150746],[115.98940679300009,-32.05569496915074]],[[115.98940690000006,-32.055694916150784],[115.99130558000004,-32.05708669015073]],[[115.99130558000004,-32.05708669015073],[115.9937186520001,-32.05879192815069]],[[115.9937186730001,-32.05879193715072],[115.99470242200005,-32.059482282150704],[115.99489488600013,-32.05961913415067],[115.99498831700008,-32.0596947051507],[115.99507624700004,-32.05977256915069],[115.99619786000008,-32.06077486315067]],[[115.99619786000008,-32.06077486315067],[115.99807211200005,-32.062450870150656],[115.99824467900008,-32.062609373150686],[115.99840962100008,-32.06276674215064],[115.99852777700004,-32.06288769215064],[115.99863907800012,-32.063020416150664],[115.99874097300004,-32.06315495915066],[115.99882580100008,-32.06329546515063],[115.99890164200006,-32.06343932915064],[115.99895604600012,-32.06358071415064]],[[115.99895604600012,-32.06358071415064],[115.99899091800012,-32.06368208915061],[115.99902222500008,-32.063788821150624],[115.99907593100008,-32.06400220715067],[115.99912074900011,-32.064210678150666],[115.99915577200012,-32.06442461115066],[115.9991818960001,-32.06463570415061],[115.99919663600008,-32.064847392150654],[115.99920328500002,-32.06505695115063],[115.99920165300011,-32.065281654150645],[115.99918984500006,-32.06548553815062],[115.99903926500008,-32.06751714815059],[115.999024856,-32.06772239115058],[115.99902083700012,-32.067941545150546],[115.99903161300006,-32.06814560715057],[115.99906674800005,-32.06834847115059],[115.99912209200012,-32.06856048015058],[115.99919450800007,-32.068759445150555]],[[115.99919450800007,-32.068759445150555],[115.99926036200009,-32.068912133150576],[115.9993598840001,-32.06909407215058],[115.9994460920001,-32.06923096215055],[115.99954764200004,-32.06937558715057],[115.99965180200002,-32.06950432015055],[115.99976726800004,-32.06963868115056],[115.99988615800008,-32.06975647015054],[116.000079045,-32.06993983915055],[116.00021068100013,-32.069993282150584]],[[116.00975369600006,-32.07969769715041],[116.00972690500008,-32.07972970215041],[116.00974449500006,-32.07975409715043],[116.00978869900008,-32.079821903150425],[116.00981339900012,-32.07986500015044],[116.00984519900008,-32.0799158031504],[116.0099140980001,-32.08003410315039],[116.01044200300012,-32.08108199715039],[116.01060730400005,-32.08142149815036],[116.01066479800012,-32.08155120115038],[116.01071630300008,-32.081699802150375],[116.01076789700004,-32.081872598150376],[116.0108100010001,-32.082039195150415]],[[116.0108100010001,-32.082039195150415],[116.01086680000004,-32.08229049815037],[116.01117879500008,-32.083817500150346]],[[116.01117879500008,-32.083817500150346],[116.01145920200008,-32.08515750015036]],[[116.0114591990001,-32.085155795150364],[116.01153080000006,-32.08550010315032],[116.01165300500008,-32.086095700150345],[116.01180209700011,-32.08683479815032],[116.01189579600008,-32.087381703150285],[116.01197119800008,-32.08781220015031],[116.01205969700004,-32.088292001150286],[116.01211020000004,-32.088533195150305]],[[116.01211020500013,-32.088533710150315],[116.01221158900012,-32.089003913150265],[116.01231180800004,-32.0894001791503],[116.0124084040001,-32.08979348615026],[116.01246047600011,-32.089992455150266],[116.01254258900008,-32.090340281150254],[116.01256533516806,-32.09046098461943]],[[115.95055200500006,-32.02766424715116],[115.95075652600008,-32.02768307015118],[115.95096309300004,-32.027705456151175],[115.95186319500012,-32.02780944315116]],[[115.95186329100012,-32.02780944315116],[115.95464018800013,-32.02818988215117]],[[115.9546401770001,-32.02818988215117],[115.95777842900009,-32.02861851615117]],[[115.95777845000008,-32.02861852515115],[115.95905179400006,-32.02881369215116]],[[115.96900255500007,-32.037312508151004],[115.97046105000004,-32.039483618150996]],[[115.97046099800002,-32.039483600151016],[115.97184500100002,-32.04154269715095]],[[115.97184500100002,-32.04154269715095],[115.97280010500002,-32.04292509415091],[115.9733682000001,-32.04376440215094]],[[115.9733682000001,-32.04376440215094],[115.97339000500008,-32.043798796150945],[115.97381259800008,-32.04442810215093]],[[115.97381259800008,-32.04442810215093],[115.97430980200012,-32.045168600150895],[115.97443690200008,-32.045364999150905],[115.97464689500008,-32.04572159715088],[115.97500619500008,-32.04627529615091],[115.97521469700008,-32.046561796150904],[115.97525139800008,-32.04661109615092]],[[115.97525139800008,-32.04661109615092],[115.97527640400008,-32.04664630015088],[115.97539260400004,-32.046804197150905],[115.97560679700008,-32.04708300315088],[115.97568210300004,-32.04717339815091],[115.97585690300002,-32.04737169615088],[115.97600410400004,-32.047527895150886],[115.97612110400009,-32.04763889815084],[115.97618919800004,-32.0476978961509],[115.97639590000006,-32.04786599615089],[115.97652749500004,-32.047965596150874],[115.97665199700008,-32.04805549515087],[115.97676800400008,-32.048131099150886],[115.9770220040001,-32.04828459615088],[115.9771674970001,-32.04836429815086],[115.97729429800006,-32.04842849615088],[115.97757290200002,-32.04856219915085]],[[115.97757290200002,-32.04856219915085],[115.977684704,-32.048612203150846],[115.97778879900012,-32.04865429615083],[115.97898049700008,-32.04909250215083],[115.980413998,-32.04965890215086]],[[115.980413998,-32.04965890215086],[115.98152059800007,-32.05009089815083]],[[115.98152059800007,-32.05009089815083],[115.98294270200006,-32.05064769715086]],[[115.98294270200006,-32.05064769715086],[115.98317380300011,-32.050736496150826],[115.98341090200005,-32.050834698150815],[115.983666502,-32.05094390115085],[115.98375919600004,-32.05099350215085],[115.983903101,-32.05107499815087],[115.98397830100012,-32.05111849615082]],[[115.98397834300012,-32.051118506150836],[115.98424921800007,-32.05127562315083],[115.98521477000008,-32.05185905815085],[115.98537990400006,-32.05196834415083],[115.98558031000005,-32.0521353511508],[115.98576371700004,-32.05231002415079],[115.98602541900004,-32.05258774015082]],[[116.00021070200012,-32.069993300150564],[116.00058170400008,-32.07034699415056],[116.00082140400004,-32.07059039815057],[116.00091009900008,-32.07068409615056],[116.00213860100008,-32.071865095150535],[116.00217830100009,-32.07190099615051],[116.00221699800012,-32.07193849515055],[116.00232459800009,-32.072037898150526]],[[116.00232459800009,-32.072037898150526],[116.00244300200006,-32.072142401150494],[116.00260530000004,-32.07227130015051],[116.00387460400007,-32.07326170015053],[116.00476389800008,-32.07394209515049]],[[116.00476389800008,-32.07394209515049],[116.00538499700008,-32.07442950315049],[116.005478905,-32.0745210011505],[116.006703495,-32.07599550015048]],[[116.00670348500012,-32.075995491150465],[116.00826297600008,-32.07787431015045],[116.00854813800004,-32.07822076015043]],[[116.00854813800004,-32.07822076015043],[116.00921988800008,-32.07903830315041],[116.009371804,-32.07921229015045],[116.00952440000005,-32.07940188915038],[116.00966849100008,-32.079584294150415],[116.00975367500006,-32.07969767915045]]]}}\n" + ] + } + ], + "source": [ + "async with aiohttp.ClientSession() as session:\n", + " async with session.get(\n", + " 'http://127.0.0.1:8080/?road=H001&slk_from=10&slk_to=20',\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())\n", + " print(\"NEW LINE API\") \n", + " async with session.get(\n", + " 'http://127.0.0.1:8080/?road=H001&slk_from=10&slk_to=20',\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# POST Line" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n", + "{\"type\":\"Feature\", \"geometry\":{\"type\":\"MultiLineString\", \"coordinates\":[[[115.94759478043025,-32.02724359866268],[115.9491510856391,-32.02749526720062],[115.9493679050882,-32.0275259575814]],[[115.94936828870043,-32.02752601100629],[115.94981237970043,-32.02758688300629],[115.95052733194623,-32.02770437290216],[115.95045395193652,-32.027634054399066],[115.95046406193659,-32.02768257239905]],[[115.95912268636819,-32.02886886523576],[115.95914750836819,-32.02883697123573],[115.95906380792819,-32.02887071243805],[115.95941265292815,-32.028920963438054]],[[115.95941218443845,-32.028920905718095],[115.95979107743854,-32.02897720271812],[115.96013355383657,-32.02902927838184]],[[115.96013292807224,-32.02902918097346],[115.96035875707223,-32.02906514997345],[115.96056262040436,-32.029110525629164],[115.96075393482892,-32.02916180156815],[115.96095739142096,-32.029230348980576],[115.96117168460687,-32.02932721955587],[115.96136730173853,-32.02943314571916],[115.96154615641066,-32.02955752092014],[115.9617027429873,-32.02967630004321],[115.96275287902338,-32.03062457516852]],[[115.96275411942214,-32.03062569294543],[115.96623144278588,-32.03365203918071],[115.9665136252707,-32.033918806061514],[115.96678844406577,-32.034198265625974],[115.96699298943716,-32.034432313047766]],[[115.9669918353745,-32.034430967277885],[115.96711514237445,-32.034577662277876],[115.96721761750413,-32.03471142357082],[115.96732845059564,-32.034867471981435],[115.96848433266901,-32.03659727509175]],[[115.96848422468534,-32.036597113112144],[115.96896032368527,-32.03731295911215],[115.96896023759022,-32.03721359288306],[115.96892757459027,-32.037262888883035]],[[115.98604781118252,-32.05267473662941],[115.98609451818255,-32.05266271462939],[115.98601056402582,-32.05264113925175],[115.98702785502586,-32.05359842125174]],[[115.98702772609674,-32.05359828929422],[115.98804623378395,-32.05456083619799],[115.9883808651614,-32.054852314339044],[115.98869459287259,-32.05511467498271],[115.9894613069384,-32.0556784583932]],[[115.98946123193977,-32.055678385185004],[115.9912935789398,-32.05702868318495]],[[115.9912950137811,-32.057029718900964],[115.9937609497811,-32.05877302890094]],[[115.99376103647067,-32.05877301309536],[115.99436080547072,-32.05919700309536],[115.99454302419855,-32.059326964623004],[115.99472198966563,-32.059459321137076],[115.99498430255129,-32.0596612201992],[115.99524357929444,-32.05987026054186],[115.99549973868855,-32.060083157241564],[115.99574919438173,-32.06030156670497],[115.99624764547441,-32.060747542620746]],[[115.99624752655862,-32.06074743603522],[115.9980907575587,-32.062402501035216],[115.99833634035728,-32.062625147036876],[115.99846204016922,-32.06274411048347],[115.99854453174663,-32.06282736846115],[115.99863233482544,-32.06292455222687],[115.99871321010953,-32.06302242000257],[115.99877960102229,-32.063114978185276],[115.99883947785277,-32.06320806246746],[115.99888544484952,-32.06328997086107],[115.99896426656018,-32.06345297863534],[115.99900947413278,-32.06357512275901]],[[115.99900716908306,-32.063568078744105],[115.99905200808304,-32.06372700574413],[115.99908558344804,-32.063879272851594],[115.99913231223387,-32.06410778132226],[115.99915510747908,-32.064253908094514],[115.99918051185215,-32.064435210452444],[115.9992001728267,-32.06461127616998],[115.9992238060796,-32.064942538152806],[115.99923403390702,-32.06525104563107],[115.99922725713554,-32.065569002086676],[115.99917800843548,-32.06629945217747],[115.99907395122533,-32.067646493975545],[115.99906692874495,-32.06784049756682],[115.99907358735024,-32.06805410905295],[115.99910133512067,-32.068266538234084],[115.99913813411554,-32.068442113106826],[115.99919378764343,-32.06863144267346],[115.9992677159209,-32.06879648347593]],[[115.99926749522349,-32.068795993107734],[115.9993192152235,-32.068911835107734],[115.99938468819998,-32.06904143071765],[115.99952520213841,-32.069273900616786],[115.99959831263214,-32.06938779148276],[115.9996898421093,-32.06951488568108],[115.9998074216397,-32.0696463624829],[115.99992072984371,-32.069762594116334],[116.00008687582223,-32.06992301829169],[116.00012698311532,-32.070025908232196]],[[116.00976872377052,-32.079786263302175],[116.0098123297705,-32.079778864302156],[116.00975916071864,-32.07978641749181],[116.0097968881386,-32.07983949704102],[116.00983538923407,-32.079894325432946],[116.00987300223404,-32.079950939922],[116.00992328182308,-32.08002436318713],[116.0103346088998,-32.08074840259607]],[[116.01033352010835,-32.08074643058606],[116.01036781710829,-32.08081043258604],[116.01046954899175,-32.080993784423924],[116.01056266333231,-32.08117124444638],[116.01064744305538,-32.08135258369713],[116.01073273703555,-32.08155483428968],[116.01077071840582,-32.0816650131953],[116.01081573146969,-32.08180416056216],[116.01085231518098,-32.081923532818784],[116.01087420079261,-32.082001733781496]],[[116.01087386158703,-32.08200030049645],[116.01089935758706,-32.082098396496484],[116.01093278170907,-32.08223978220565],[116.01103048383175,-32.08278350681508],[116.01110486596399,-32.08321631898367],[116.011127072433,-32.083350740227395],[116.0112176849121,-32.083807491600034]],[[116.01121638702695,-32.083810620772944],[116.01139249602693,-32.08455342077296],[116.01145570716322,-32.08486118188947],[116.01152016744854,-32.085154481356675]],[[116.01151993410464,-32.0851550271393],[116.01186613618484,-32.086825990213356],[116.01191519142269,-32.08710903831853],[116.01196911320321,-32.08746003853017],[116.01202969515793,-32.08777394052844],[116.0120901235675,-32.088075547333396],[116.01219539171635,-32.08851991524432]],[[116.01219526916127,-32.088519299946945],[116.0122646571612,-32.08882150594695],[116.0122991827425,-32.08896793383594],[116.01235407404697,-32.08921823209403],[116.01247892486911,-32.089821234346395],[116.01259399540768,-32.0903083727827],[116.01261842846722,-32.090452201595255]],[[115.94756555740906,-32.027399499919916],[115.94890016576123,-32.02759386742557],[115.94935871236004,-32.027654710885585]],[[115.94935863511542,-32.02765468407174],[115.95008186011543,-32.02775118307172],[115.95029772125851,-32.027776086939745],[115.9505907840771,-32.02780434897137],[115.95063488129749,-32.02769890716338]],[[115.95896817496349,-32.02884651978961],[115.95900398151181,-32.028937726748616],[115.95937596079534,-32.02899440811346]],[[115.9593759922957,-32.028994420234866],[115.96022591129567,-32.02912372823487],[115.96041406633796,-32.02916036952993],[115.96058918925152,-32.02919996860107],[115.96075883667434,-32.0292478727007],[115.96090860264916,-32.02930351294558],[115.96104985827823,-32.02936532206368],[115.96118321097691,-32.029435189522516],[115.96131132757361,-32.02951844558616],[115.9614418966278,-32.02961509635462],[115.96265657025224,-32.0307042389331]],[[115.96265751326277,-32.030705072359176],[115.9662143605588,-32.033804613658276],[115.96646871263643,-32.034055286118274],[115.96667909230162,-32.03427798346707],[115.9668928486542,-32.034517235554844]],[[115.96688967271069,-32.034513479479365],[115.96702734071067,-32.03468564147937],[115.96717476012708,-32.0348787665665],[115.96733790699335,-32.03510229802522],[115.96775060619322,-32.03571965982088]],[[115.96775013499311,-32.03571890672592],[115.96838840799317,-32.036694322725914]],[[115.96838996875168,-32.03669662906223],[115.96889086919386,-32.037412643894015],[115.96901043696482,-32.037401984327765]],[[115.98594661336756,-32.0525446185853],[115.9858940457619,-32.05264068706897],[115.98609427309819,-32.052873900648606],[115.98625607889366,-32.05305521438048],[115.98692303516,-32.053686996446075]],[[115.98692269194825,-32.053686669612716],[115.9877018479483,-32.05443257261271],[115.98783614129033,-32.05455519547091],[115.98796471128585,-32.05466571639471],[115.98833391970228,-32.054986648849436],[115.98851427374444,-32.05514096368121],[115.98870386583563,-32.055290675843715],[115.98935365926212,-32.055767402589254]],[[115.9893537912648,-32.05576736792346],[115.99125247126479,-32.05715914192341]],[[115.99125373696046,-32.0571600529231],[115.99366680896051,-32.05886529092306]],[[115.99366707141697,-32.058865469957965],[115.99465082041691,-32.059555814957946],[115.99484282904268,-32.05969234528579],[115.99493182356906,-32.059764549902646],[115.99501669241056,-32.05983982276022],[115.99613800207129,-32.06084184692098]],[[115.99613797940982,-32.06084182666338],[115.99801223140979,-32.062517833663364],[115.99818391134812,-32.062675532727454],[115.99834760974541,-32.062831737546],[115.99846351828208,-32.06295046646297],[115.99857024538281,-32.06307813848532],[115.99866936050545,-32.06320919426605],[115.99874889756909,-32.063341894230156],[115.99882217602612,-32.06348122134693],[115.99887220664999,-32.06361297497045]],[[115.99887109930769,-32.06360993497489],[115.99890597130769,-32.06371130997486],[115.99893602472201,-32.063814105714776],[115.99898881575373,-32.064024132728825],[115.99903292359551,-32.064229559237184],[115.99906712007619,-32.064439124368974],[115.99909274406046,-32.064646737227356],[115.99910702093472,-32.06485363211731],[115.99911349813334,-32.06505979995632],[115.99911182331981,-32.06528100172486],[115.99910016322903,-32.06548034420525],[115.99894967868742,-32.06751050814244],[115.9989352445124,-32.067716100013094],[115.9989310200524,-32.06793989802431],[115.99894190594334,-32.06815034435415],[115.99897823369925,-32.06836380137162],[115.9990351726941,-32.068583170046196],[115.99911009330361,-32.068790169019856]],[[115.9991120209629,-32.068795021629036],[115.99917787496291,-32.06894770962906],[115.99928107234933,-32.06913718271571],[115.99937007767676,-32.06927883301612],[115.99947412342514,-32.069427209009],[115.9995819665933,-32.06956082513344],[115.99969913750206,-32.069697230551654],[115.99982293332354,-32.06982028580223],[116.0000294847946,-32.07001667139942],[116.00017688880017,-32.07007651606401]],[[116.00968481247266,-32.07964003557936],[116.00965802147267,-32.07967204057936],[116.00967162948257,-32.07980663678768],[116.00971344593731,-32.07987096203001],[116.0097354599832,-32.079909669007215],[116.00976905401056,-32.07996346589995],[116.00983647176484,-32.080079313378484],[116.01036177634772,-32.08112241350065],[116.01052653682115,-32.08146082320518],[116.01058267280817,-32.081587605133265],[116.01063142465802,-32.081729220922824],[116.01068182001156,-32.08189829930168],[116.01072290733572,-32.08206120630097]],[[116.01072237911988,-32.082058999272014],[116.01077917811983,-32.08231030227197],[116.01109078128283,-32.08383548299498]],[[116.01109086746756,-32.08383589977394],[116.01137127446756,-32.08517589977395]],[[116.01137124856636,-32.08517408499261],[116.01144284956632,-32.08551839299257],[116.01156500619092,-32.086113755806224],[116.01171377781402,-32.086851268098705],[116.01180725401962,-32.08739687268617],[116.01188271296475,-32.087827698396836],[116.01197135514636,-32.08830829575098],[116.01202227473344,-32.0885516055989]],[[116.01202239103694,-32.08855264437839],[116.01212377503693,-32.08902284737834],[116.01222471803518,-32.089422204933946],[116.01232116453106,-32.08981491211969],[116.01237357080474,-32.09001519903165],[116.01245516018464,-32.09036092090208],[116.01247705691942,-32.09047762036227]],[[115.95054377214113,-32.0277537011458],[115.95074829314115,-32.02777252414582],[115.95095341442416,-32.02779476529008],[115.95185288545278,-32.027898681653824]],[[115.95185109777418,-32.0278984438386],[115.95462799477419,-32.028278882838606]],[[115.95462802027689,-32.02827888783191],[115.95776627227687,-32.02870752183191]],[[115.95776484026386,-32.02870732026478],[115.95903818426385,-32.02890248726479]],[[115.96892798645315,-32.03736260135348],[115.97038648145312,-32.03953371135347]],[[115.97038644211622,-32.039533712198605],[115.97177044511622,-32.04159280919854]],[[115.97177109328115,-32.04159376031003],[115.97272595298924,-32.042975803727124],[115.97329380709137,-32.043814755822645]],[[115.97329233024854,-32.0438125018175],[115.97331413524853,-32.0438468958175],[115.97373802076874,-32.04447818242337]],[[115.97373801811631,-32.04447817847327],[115.97423522211635,-32.04521867647323],[115.97436148489635,-32.04541380547823],[115.97457047690743,-32.045768861031256],[115.97493214681745,-32.04632621217938],[115.9751420632695,-32.04661465576031],[115.97517934058645,-32.04666473872976]],[[115.97517816143635,-32.04666311732791],[115.97520316743635,-32.046698321327874],[115.97532025243257,-32.04685744231791],[115.97553556024738,-32.047137730860385],[115.97561308340948,-32.047230896787795],[115.97578951507383,-32.04743109871419],[115.97593872804131,-32.04758950506197],[115.97605927527546,-32.04770406720742],[115.97613037381365,-32.047765789539525],[115.97633922117396,-32.04793569053944],[115.97647328145707,-32.04803722497805],[115.97659940853109,-32.048128325433396],[115.97671895565298,-32.04820635907894],[115.97697554186834,-32.04836147961747],[115.97712433799684,-32.048443083286266],[115.97725372113912,-32.048508641740156],[115.97753403524158,-32.04864318786742]],[[115.9775362253921,-32.04864420295292],[115.97764802739208,-32.048694206952916],[115.9777551226393,-32.04873757700004],[115.97894848551255,-32.04917644389399],[115.98038098723116,-32.04974244906142]],[[115.98038133025207,-32.04974258378187],[115.98148793025214,-32.05017457978184]],[[115.98148784675755,-32.05017454713908],[115.98290995075753,-32.05073134613911]],[[115.9829104813591,-32.05073155195048],[115.98314158235915,-32.050820350950445],[115.98337652704014,-32.05091769308593],[115.9836312082401,-32.05102650955015],[115.98371681289996,-32.05107270739027],[115.98385883329829,-32.051153165712606],[115.9839333219703,-32.051196256577775]],[[115.98393327059657,-32.05119621249267],[115.98420414559652,-32.05135332949266],[115.98516831173667,-32.05193594395503],[115.98533032672599,-32.05204325670665],[115.9855228005169,-32.052204361704135],[115.98570176392442,-32.05237507500433],[115.98596004117411,-32.05264934808051]],[[116.00014871590072,-32.07005831953694],[116.00051971790069,-32.07041201353694],[116.00075739801004,-32.0706534301295],[116.0008463160171,-32.07074738921568],[116.00207634455167,-32.07192985572306],[116.00211804813846,-32.07196762489647],[116.00215448358863,-32.072003006742364],[116.0022636402499,-32.07210388261699]],[[116.00226515393564,-32.07210524947067],[116.00238355793562,-32.072209752470634],[116.0025494309873,-32.07234164537451],[116.00381967901251,-32.07333278619],[116.00470931196506,-32.074013440521085]],[[116.00470843992856,-32.07401276480047],[116.00532575353083,-32.07449720220619],[116.00541282363267,-32.07458203779191],[116.00663438833595,-32.07605289410581]],[[116.00663436221178,-32.07605286568538],[116.00819385321175,-32.07793168468536],[116.00847877921403,-32.078277849167996]],[[116.00847873061333,-32.078277790070594],[116.00915048061337,-32.079095333070576],[116.00930413634738,-32.07927137386997],[116.0094544183283,-32.079458212881995],[116.00959799973734,-32.079639978789224],[116.00968185354726,-32.0797516372457]]]}}\n" + ] + } + ], + "source": [ + "async with aiohttp.ClientSession() as session:\n", + " async with session.post(\n", + " 'http://127.0.0.1:8080/line',\n", + " json={\n", + " \"road\":\"H001\",\n", + " \"slk_from\":10,\n", + " \"slk_to\":20,\n", + " \"offset\":10\n", + " }\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# POST Batch2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "query_parameters = {\n", + " \"format\":\"wkt\",\n", + " \"items\":[\n", + " {\n", + " \"road\":\"H001\",\n", + " \"slk_from\":10,\n", + " \"slk_to\":20,\n", + " \"offset\":10\n", + " },\n", + " {\n", + " \"road\":\"H016\",\n", + " \"slk\":10\n", + " },\n", + " {\n", + " \"road\":\"H015\",\n", + " \"slk\":10\n", + " }\n", + " ]\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n", + "[MULTILINESTRING ((115.94759478043025 -32.02724359866268,115.9491510856391 -32.02749526720062,115.9493679050882 -32.0275259575814),(115.94936828870043 -32.02752601100629,115.94981237970043 -32.02758688300629,115.95052733194623 -32.02770437290216,115.95045395193652 -32.027634054399066,115.95046406193659 -32.02768257239905),(115.95912268636819 -32.02886886523576,115.95914750836819 -32.02883697123573,115.95906380792819 -32.02887071243805,115.95941265292815 -32.028920963438054),(115.95941218443845 -32.028920905718095,115.95979107743854 -32.02897720271812,115.96013355383657 -32.02902927838184),(115.96013292807224 -32.02902918097346,115.96035875707223 -32.02906514997345,115.96056262040436 -32.029110525629164,115.96075393482892 -32.02916180156815,115.96095739142096 -32.029230348980576,115.96117168460687 -32.02932721955587,115.96136730173853 -32.02943314571916,115.96154615641066 -32.02955752092014,115.9617027429873 -32.02967630004321,115.96275287902338 -32.03062457516852),(115.96275411942214 -32.03062569294543,115.96623144278588 -32.03365203918071,115.9665136252707 -32.033918806061514,115.96678844406577 -32.034198265625974,115.96699298943716 -32.034432313047766),(115.9669918353745 -32.034430967277885,115.96711514237445 -32.034577662277876,115.96721761750413 -32.03471142357082,115.96732845059564 -32.034867471981435,115.96848433266901 -32.03659727509175),(115.96848422468534 -32.036597113112144,115.96896032368527 -32.03731295911215,115.96896023759022 -32.03721359288306,115.96892757459027 -32.037262888883035),(115.98604781118252 -32.05267473662941,115.98609451818255 -32.05266271462939,115.98601056402582 -32.05264113925175,115.98702785502586 -32.05359842125174),(115.98702772609674 -32.05359828929422,115.98804623378395 -32.05456083619799,115.9883808651614 -32.054852314339044,115.98869459287259 -32.05511467498271,115.9894613069384 -32.0556784583932),(115.98946123193977 -32.055678385185004,115.9912935789398 -32.05702868318495),(115.9912950137811 -32.057029718900964,115.9937609497811 -32.05877302890094),(115.99376103647067 -32.05877301309536,115.99436080547072 -32.05919700309536,115.99454302419855 -32.059326964623004,115.99472198966563 -32.059459321137076,115.99498430255129 -32.0596612201992,115.99524357929444 -32.05987026054186,115.99549973868855 -32.060083157241564,115.99574919438173 -32.06030156670497,115.99624764547441 -32.060747542620746),(115.99624752655862 -32.06074743603522,115.9980907575587 -32.062402501035216,115.99833634035728 -32.062625147036876,115.99846204016922 -32.06274411048347,115.99854453174663 -32.06282736846115,115.99863233482544 -32.06292455222687,115.99871321010953 -32.06302242000257,115.99877960102229 -32.063114978185276,115.99883947785277 -32.06320806246746,115.99888544484952 -32.06328997086107,115.99896426656018 -32.06345297863534,115.99900947413278 -32.06357512275901),(115.99900716908306 -32.063568078744105,115.99905200808304 -32.06372700574413,115.99908558344804 -32.063879272851594,115.99913231223387 -32.06410778132226,115.99915510747908 -32.064253908094514,115.99918051185215 -32.064435210452444,115.9992001728267 -32.06461127616998,115.9992238060796 -32.064942538152806,115.99923403390702 -32.06525104563107,115.99922725713554 -32.065569002086676,115.99917800843548 -32.06629945217747,115.99907395122533 -32.067646493975545,115.99906692874495 -32.06784049756682,115.99907358735024 -32.06805410905295,115.99910133512067 -32.068266538234084,115.99913813411554 -32.068442113106826,115.99919378764343 -32.06863144267346,115.9992677159209 -32.06879648347593),(115.99926749522349 -32.068795993107734,115.9993192152235 -32.068911835107734,115.99938468819998 -32.06904143071765,115.99952520213841 -32.069273900616786,115.99959831263214 -32.06938779148276,115.9996898421093 -32.06951488568108,115.9998074216397 -32.0696463624829,115.99992072984371 -32.069762594116334,116.00008687582223 -32.06992301829169,116.00012698311532 -32.070025908232196),(116.00976872377052 -32.079786263302175,116.0098123297705 -32.079778864302156,116.00975916071864 -32.07978641749181,116.0097968881386 -32.07983949704102,116.00983538923407 -32.079894325432946,116.00987300223404 -32.079950939922,116.00992328182308 -32.08002436318713,116.0103346088998 -32.08074840259607),(116.01033352010835 -32.08074643058606,116.01036781710829 -32.08081043258604,116.01046954899175 -32.080993784423924,116.01056266333231 -32.08117124444638,116.01064744305538 -32.08135258369713,116.01073273703555 -32.08155483428968,116.01077071840582 -32.0816650131953,116.01081573146969 -32.08180416056216,116.01085231518098 -32.081923532818784,116.01087420079261 -32.082001733781496),(116.01087386158703 -32.08200030049645,116.01089935758706 -32.082098396496484,116.01093278170907 -32.08223978220565,116.01103048383175 -32.08278350681508,116.01110486596399 -32.08321631898367,116.011127072433 -32.083350740227395,116.0112176849121 -32.083807491600034),(116.01121638702695 -32.083810620772944,116.01139249602693 -32.08455342077296,116.01145570716322 -32.08486118188947,116.01152016744854 -32.085154481356675),(116.01151993410464 -32.0851550271393,116.01186613618484 -32.086825990213356,116.01191519142269 -32.08710903831853,116.01196911320321 -32.08746003853017,116.01202969515793 -32.08777394052844,116.0120901235675 -32.088075547333396,116.01219539171635 -32.08851991524432),(116.01219526916127 -32.088519299946945,116.0122646571612 -32.08882150594695,116.0122991827425 -32.08896793383594,116.01235407404697 -32.08921823209403,116.01247892486911 -32.089821234346395,116.01259399540768 -32.0903083727827,116.01261842846722 -32.090452201595255),(115.94756555740906 -32.027399499919916,115.94890016576123 -32.02759386742557,115.94935871236004 -32.027654710885585),(115.94935863511542 -32.02765468407174,115.95008186011543 -32.02775118307172,115.95029772125851 -32.027776086939745,115.9505907840771 -32.02780434897137,115.95063488129749 -32.02769890716338),(115.95896817496349 -32.02884651978961,115.95900398151181 -32.028937726748616,115.95937596079534 -32.02899440811346),(115.9593759922957 -32.028994420234866,115.96022591129567 -32.02912372823487,115.96041406633796 -32.02916036952993,115.96058918925152 -32.02919996860107,115.96075883667434 -32.0292478727007,115.96090860264916 -32.02930351294558,115.96104985827823 -32.02936532206368,115.96118321097691 -32.029435189522516,115.96131132757361 -32.02951844558616,115.9614418966278 -32.02961509635462,115.96265657025224 -32.0307042389331),(115.96265751326277 -32.030705072359176,115.9662143605588 -32.033804613658276,115.96646871263643 -32.034055286118274,115.96667909230162 -32.03427798346707,115.9668928486542 -32.034517235554844),(115.96688967271069 -32.034513479479365,115.96702734071067 -32.03468564147937,115.96717476012708 -32.0348787665665,115.96733790699335 -32.03510229802522,115.96775060619322 -32.03571965982088),(115.96775013499311 -32.03571890672592,115.96838840799317 -32.036694322725914),(115.96838996875168 -32.03669662906223,115.96889086919386 -32.037412643894015,115.96901043696482 -32.037401984327765),(115.98594661336756 -32.0525446185853,115.9858940457619 -32.05264068706897,115.98609427309819 -32.052873900648606,115.98625607889366 -32.05305521438048,115.98692303516 -32.053686996446075),(115.98692269194825 -32.053686669612716,115.9877018479483 -32.05443257261271,115.98783614129033 -32.05455519547091,115.98796471128585 -32.05466571639471,115.98833391970228 -32.054986648849436,115.98851427374444 -32.05514096368121,115.98870386583563 -32.055290675843715,115.98935365926212 -32.055767402589254),(115.9893537912648 -32.05576736792346,115.99125247126479 -32.05715914192341),(115.99125373696046 -32.0571600529231,115.99366680896051 -32.05886529092306),(115.99366707141697 -32.058865469957965,115.99465082041691 -32.059555814957946,115.99484282904268 -32.05969234528579,115.99493182356906 -32.059764549902646,115.99501669241056 -32.05983982276022,115.99613800207129 -32.06084184692098),(115.99613797940982 -32.06084182666338,115.99801223140979 -32.062517833663364,115.99818391134812 -32.062675532727454,115.99834760974541 -32.062831737546,115.99846351828208 -32.06295046646297,115.99857024538281 -32.06307813848532,115.99866936050545 -32.06320919426605,115.99874889756909 -32.063341894230156,115.99882217602612 -32.06348122134693,115.99887220664999 -32.06361297497045),(115.99887109930769 -32.06360993497489,115.99890597130769 -32.06371130997486,115.99893602472201 -32.063814105714776,115.99898881575373 -32.064024132728825,115.99903292359551 -32.064229559237184,115.99906712007619 -32.064439124368974,115.99909274406046 -32.064646737227356,115.99910702093472 -32.06485363211731,115.99911349813334 -32.06505979995632,115.99911182331981 -32.06528100172486,115.99910016322903 -32.06548034420525,115.99894967868742 -32.06751050814244,115.9989352445124 -32.067716100013094,115.9989310200524 -32.06793989802431,115.99894190594334 -32.06815034435415,115.99897823369925 -32.06836380137162,115.9990351726941 -32.068583170046196,115.99911009330361 -32.068790169019856),(115.9991120209629 -32.068795021629036,115.99917787496291 -32.06894770962906,115.99928107234933 -32.06913718271571,115.99937007767676 -32.06927883301612,115.99947412342514 -32.069427209009,115.9995819665933 -32.06956082513344,115.99969913750206 -32.069697230551654,115.99982293332354 -32.06982028580223,116.0000294847946 -32.07001667139942,116.00017688880017 -32.07007651606401),(116.00968481247266 -32.07964003557936,116.00965802147267 -32.07967204057936,116.00967162948257 -32.07980663678768,116.00971344593731 -32.07987096203001,116.0097354599832 -32.079909669007215,116.00976905401056 -32.07996346589995,116.00983647176484 -32.080079313378484,116.01036177634772 -32.08112241350065,116.01052653682115 -32.08146082320518,116.01058267280817 -32.081587605133265,116.01063142465802 -32.081729220922824,116.01068182001156 -32.08189829930168,116.01072290733572 -32.08206120630097),(116.01072237911988 -32.082058999272014,116.01077917811983 -32.08231030227197,116.01109078128283 -32.08383548299498),(116.01109086746756 -32.08383589977394,116.01137127446756 -32.08517589977395),(116.01137124856636 -32.08517408499261,116.01144284956632 -32.08551839299257,116.01156500619092 -32.086113755806224,116.01171377781402 -32.086851268098705,116.01180725401962 -32.08739687268617,116.01188271296475 -32.087827698396836,116.01197135514636 -32.08830829575098,116.01202227473344 -32.0885516055989),(116.01202239103694 -32.08855264437839,116.01212377503693 -32.08902284737834,116.01222471803518 -32.089422204933946,116.01232116453106 -32.08981491211969,116.01237357080474 -32.09001519903165,116.01245516018464 -32.09036092090208,116.01247705691942 -32.09047762036227),(115.95054377214113 -32.0277537011458,115.95074829314115 -32.02777252414582,115.95095341442416 -32.02779476529008,115.95185288545278 -32.027898681653824),(115.95185109777418 -32.0278984438386,115.95462799477419 -32.028278882838606),(115.95462802027689 -32.02827888783191,115.95776627227687 -32.02870752183191),(115.95776484026386 -32.02870732026478,115.95903818426385 -32.02890248726479),(115.96892798645315 -32.03736260135348,115.97038648145312 -32.03953371135347),(115.97038644211622 -32.039533712198605,115.97177044511622 -32.04159280919854),(115.97177109328115 -32.04159376031003,115.97272595298924 -32.042975803727124,115.97329380709137 -32.043814755822645),(115.97329233024854 -32.0438125018175,115.97331413524853 -32.0438468958175,115.97373802076874 -32.04447818242337),(115.97373801811631 -32.04447817847327,115.97423522211635 -32.04521867647323,115.97436148489635 -32.04541380547823,115.97457047690743 -32.045768861031256,115.97493214681745 -32.04632621217938,115.9751420632695 -32.04661465576031,115.97517934058645 -32.04666473872976),(115.97517816143635 -32.04666311732791,115.97520316743635 -32.046698321327874,115.97532025243257 -32.04685744231791,115.97553556024738 -32.047137730860385,115.97561308340948 -32.047230896787795,115.97578951507383 -32.04743109871419,115.97593872804131 -32.04758950506197,115.97605927527546 -32.04770406720742,115.97613037381365 -32.047765789539525,115.97633922117396 -32.04793569053944,115.97647328145707 -32.04803722497805,115.97659940853109 -32.048128325433396,115.97671895565298 -32.04820635907894,115.97697554186834 -32.04836147961747,115.97712433799684 -32.048443083286266,115.97725372113912 -32.048508641740156,115.97753403524158 -32.04864318786742),(115.9775362253921 -32.04864420295292,115.97764802739208 -32.048694206952916,115.9777551226393 -32.04873757700004,115.97894848551255 -32.04917644389399,115.98038098723116 -32.04974244906142),(115.98038133025207 -32.04974258378187,115.98148793025214 -32.05017457978184),(115.98148784675755 -32.05017454713908,115.98290995075753 -32.05073134613911),(115.9829104813591 -32.05073155195048,115.98314158235915 -32.050820350950445,115.98337652704014 -32.05091769308593,115.9836312082401 -32.05102650955015,115.98371681289996 -32.05107270739027,115.98385883329829 -32.051153165712606,115.9839333219703 -32.051196256577775),(115.98393327059657 -32.05119621249267,115.98420414559652 -32.05135332949266,115.98516831173667 -32.05193594395503,115.98533032672599 -32.05204325670665,115.9855228005169 -32.052204361704135,115.98570176392442 -32.05237507500433,115.98596004117411 -32.05264934808051),(116.00014871590072 -32.07005831953694,116.00051971790069 -32.07041201353694,116.00075739801004 -32.0706534301295,116.0008463160171 -32.07074738921568,116.00207634455167 -32.07192985572306,116.00211804813846 -32.07196762489647,116.00215448358863 -32.072003006742364,116.0022636402499 -32.07210388261699),(116.00226515393564 -32.07210524947067,116.00238355793562 -32.072209752470634,116.0025494309873 -32.07234164537451,116.00381967901251 -32.07333278619,116.00470931196506 -32.074013440521085),(116.00470843992856 -32.07401276480047,116.00532575353083 -32.07449720220619,116.00541282363267 -32.07458203779191,116.00663438833595 -32.07605289410581),(116.00663436221178 -32.07605286568538,116.00819385321175 -32.07793168468536,116.00847877921403 -32.078277849167996),(116.00847873061333 -32.078277790070594,116.00915048061337 -32.079095333070576,116.00930413634738 -32.07927137386997,116.0094544183283 -32.079458212881995,116.00959799973734 -32.079639978789224,116.00968185354726 -32.0797516372457)),MULTIPOINT ((115.8018372737292 -31.890062043719624),(115.80208275968369 -31.88999214761082)),MULTIPOINT ((115.85393141776753 -32.048215776792965),(115.85365425352151 -32.04809166414051))]\n" + ] + } + ], + "source": [ + "async with aiohttp.ClientSession() as session:\n", + " async with session.post(\n", + " 'http://127.0.0.1:8080/batch2/',\n", + " json=query_parameters\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# GET batch2" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n", + "[\"MULTILINESTRING ((115.94759478043025 -32.02724359866268,115.9491510856391 -32.02749526720062,115.9493679050882 -32.0275259575814),(115.94936828870043 -32.02752601100629,115.94981237970043 -32.02758688300629,115.95052733194623 -32.02770437290216,115.95045395193652 -32.027634054399066,115.95046406193659 -32.02768257239905),(115.95912268636819 -32.02886886523576,115.95914750836819 -32.02883697123573,115.95906380792819 -32.02887071243805,115.95941265292815 -32.028920963438054),(115.95941218443845 -32.028920905718095,115.95979107743854 -32.02897720271812,115.96013355383657 -32.02902927838184),(115.96013292807224 -32.02902918097346,115.96035875707223 -32.02906514997345,115.96056262040436 -32.029110525629164,115.96075393482892 -32.02916180156815,115.96095739142096 -32.029230348980576,115.96117168460687 -32.02932721955587,115.96136730173853 -32.02943314571916,115.96154615641066 -32.02955752092014,115.9617027429873 -32.02967630004321,115.96275287902338 -32.03062457516852),(115.96275411942214 -32.03062569294543,115.96623144278588 -32.03365203918071,115.9665136252707 -32.033918806061514,115.96678844406577 -32.034198265625974,115.96699298943716 -32.034432313047766),(115.9669918353745 -32.034430967277885,115.96711514237445 -32.034577662277876,115.96721761750413 -32.03471142357082,115.96732845059564 -32.034867471981435,115.96848433266901 -32.03659727509175),(115.96848422468534 -32.036597113112144,115.96896032368527 -32.03731295911215,115.96896023759022 -32.03721359288306,115.96892757459027 -32.037262888883035),(115.98604781118252 -32.05267473662941,115.98609451818255 -32.05266271462939,115.98601056402582 -32.05264113925175,115.98702785502586 -32.05359842125174),(115.98702772609674 -32.05359828929422,115.98804623378395 -32.05456083619799,115.9883808651614 -32.054852314339044,115.98869459287259 -32.05511467498271,115.9894613069384 -32.0556784583932),(115.98946123193977 -32.055678385185004,115.9912935789398 -32.05702868318495),(115.9912950137811 -32.057029718900964,115.9937609497811 -32.05877302890094),(115.99376103647067 -32.05877301309536,115.99436080547072 -32.05919700309536,115.99454302419855 -32.059326964623004,115.99472198966563 -32.059459321137076,115.99498430255129 -32.0596612201992,115.99524357929444 -32.05987026054186,115.99549973868855 -32.060083157241564,115.99574919438173 -32.06030156670497,115.99624764547441 -32.060747542620746),(115.99624752655862 -32.06074743603522,115.9980907575587 -32.062402501035216,115.99833634035728 -32.062625147036876,115.99846204016922 -32.06274411048347,115.99854453174663 -32.06282736846115,115.99863233482544 -32.06292455222687,115.99871321010953 -32.06302242000257,115.99877960102229 -32.063114978185276,115.99883947785277 -32.06320806246746,115.99888544484952 -32.06328997086107,115.99896426656018 -32.06345297863534,115.99900947413278 -32.06357512275901),(115.99900716908306 -32.063568078744105,115.99905200808304 -32.06372700574413,115.99908558344804 -32.063879272851594,115.99913231223387 -32.06410778132226,115.99915510747908 -32.064253908094514,115.99918051185215 -32.064435210452444,115.9992001728267 -32.06461127616998,115.9992238060796 -32.064942538152806,115.99923403390702 -32.06525104563107,115.99922725713554 -32.065569002086676,115.99917800843548 -32.06629945217747,115.99907395122533 -32.067646493975545,115.99906692874495 -32.06784049756682,115.99907358735024 -32.06805410905295,115.99910133512067 -32.068266538234084,115.99913813411554 -32.068442113106826,115.99919378764343 -32.06863144267346,115.9992677159209 -32.06879648347593),(115.99926749522349 -32.068795993107734,115.9993192152235 -32.068911835107734,115.99938468819998 -32.06904143071765,115.99952520213841 -32.069273900616786,115.99959831263214 -32.06938779148276,115.9996898421093 -32.06951488568108,115.9998074216397 -32.0696463624829,115.99992072984371 -32.069762594116334,116.00008687582223 -32.06992301829169,116.00012698311532 -32.070025908232196),(116.00976872377052 -32.079786263302175,116.0098123297705 -32.079778864302156,116.00975916071864 -32.07978641749181,116.0097968881386 -32.07983949704102,116.00983538923407 -32.079894325432946,116.00987300223404 -32.079950939922,116.00992328182308 -32.08002436318713,116.0103346088998 -32.08074840259607),(116.01033352010835 -32.08074643058606,116.01036781710829 -32.08081043258604,116.01046954899175 -32.080993784423924,116.01056266333231 -32.08117124444638,116.01064744305538 -32.08135258369713,116.01073273703555 -32.08155483428968,116.01077071840582 -32.0816650131953,116.01081573146969 -32.08180416056216,116.01085231518098 -32.081923532818784,116.01087420079261 -32.082001733781496),(116.01087386158703 -32.08200030049645,116.01089935758706 -32.082098396496484,116.01093278170907 -32.08223978220565,116.01103048383175 -32.08278350681508,116.01110486596399 -32.08321631898367,116.011127072433 -32.083350740227395,116.0112176849121 -32.083807491600034),(116.01121638702695 -32.083810620772944,116.01139249602693 -32.08455342077296,116.01145570716322 -32.08486118188947,116.01152016744854 -32.085154481356675),(116.01151993410464 -32.0851550271393,116.01186613618484 -32.086825990213356,116.01191519142269 -32.08710903831853,116.01196911320321 -32.08746003853017,116.01202969515793 -32.08777394052844,116.0120901235675 -32.088075547333396,116.01219539171635 -32.08851991524432),(116.01219526916127 -32.088519299946945,116.0122646571612 -32.08882150594695,116.0122991827425 -32.08896793383594,116.01235407404697 -32.08921823209403,116.01247892486911 -32.089821234346395,116.01259399540768 -32.0903083727827,116.01261842846722 -32.090452201595255),(115.94756555740906 -32.027399499919916,115.94890016576123 -32.02759386742557,115.94935871236004 -32.027654710885585),(115.94935863511542 -32.02765468407174,115.95008186011543 -32.02775118307172,115.95029772125851 -32.027776086939745,115.9505907840771 -32.02780434897137,115.95063488129749 -32.02769890716338),(115.95896817496349 -32.02884651978961,115.95900398151181 -32.028937726748616,115.95937596079534 -32.02899440811346),(115.9593759922957 -32.028994420234866,115.96022591129567 -32.02912372823487,115.96041406633796 -32.02916036952993,115.96058918925152 -32.02919996860107,115.96075883667434 -32.0292478727007,115.96090860264916 -32.02930351294558,115.96104985827823 -32.02936532206368,115.96118321097691 -32.029435189522516,115.96131132757361 -32.02951844558616,115.9614418966278 -32.02961509635462,115.96265657025224 -32.0307042389331),(115.96265751326277 -32.030705072359176,115.9662143605588 -32.033804613658276,115.96646871263643 -32.034055286118274,115.96667909230162 -32.03427798346707,115.9668928486542 -32.034517235554844),(115.96688967271069 -32.034513479479365,115.96702734071067 -32.03468564147937,115.96717476012708 -32.0348787665665,115.96733790699335 -32.03510229802522,115.96775060619322 -32.03571965982088),(115.96775013499311 -32.03571890672592,115.96838840799317 -32.036694322725914),(115.96838996875168 -32.03669662906223,115.96889086919386 -32.037412643894015,115.96901043696482 -32.037401984327765),(115.98594661336756 -32.0525446185853,115.9858940457619 -32.05264068706897,115.98609427309819 -32.052873900648606,115.98625607889366 -32.05305521438048,115.98692303516 -32.053686996446075),(115.98692269194825 -32.053686669612716,115.9877018479483 -32.05443257261271,115.98783614129033 -32.05455519547091,115.98796471128585 -32.05466571639471,115.98833391970228 -32.054986648849436,115.98851427374444 -32.05514096368121,115.98870386583563 -32.055290675843715,115.98935365926212 -32.055767402589254),(115.9893537912648 -32.05576736792346,115.99125247126479 -32.05715914192341),(115.99125373696046 -32.0571600529231,115.99366680896051 -32.05886529092306),(115.99366707141697 -32.058865469957965,115.99465082041691 -32.059555814957946,115.99484282904268 -32.05969234528579,115.99493182356906 -32.059764549902646,115.99501669241056 -32.05983982276022,115.99613800207129 -32.06084184692098),(115.99613797940982 -32.06084182666338,115.99801223140979 -32.062517833663364,115.99818391134812 -32.062675532727454,115.99834760974541 -32.062831737546,115.99846351828208 -32.06295046646297,115.99857024538281 -32.06307813848532,115.99866936050545 -32.06320919426605,115.99874889756909 -32.063341894230156,115.99882217602612 -32.06348122134693,115.99887220664999 -32.06361297497045),(115.99887109930769 -32.06360993497489,115.99890597130769 -32.06371130997486,115.99893602472201 -32.063814105714776,115.99898881575373 -32.064024132728825,115.99903292359551 -32.064229559237184,115.99906712007619 -32.064439124368974,115.99909274406046 -32.064646737227356,115.99910702093472 -32.06485363211731,115.99911349813334 -32.06505979995632,115.99911182331981 -32.06528100172486,115.99910016322903 -32.06548034420525,115.99894967868742 -32.06751050814244,115.9989352445124 -32.067716100013094,115.9989310200524 -32.06793989802431,115.99894190594334 -32.06815034435415,115.99897823369925 -32.06836380137162,115.9990351726941 -32.068583170046196,115.99911009330361 -32.068790169019856),(115.9991120209629 -32.068795021629036,115.99917787496291 -32.06894770962906,115.99928107234933 -32.06913718271571,115.99937007767676 -32.06927883301612,115.99947412342514 -32.069427209009,115.9995819665933 -32.06956082513344,115.99969913750206 -32.069697230551654,115.99982293332354 -32.06982028580223,116.0000294847946 -32.07001667139942,116.00017688880017 -32.07007651606401),(116.00968481247266 -32.07964003557936,116.00965802147267 -32.07967204057936,116.00967162948257 -32.07980663678768,116.00971344593731 -32.07987096203001,116.0097354599832 -32.079909669007215,116.00976905401056 -32.07996346589995,116.00983647176484 -32.080079313378484,116.01036177634772 -32.08112241350065,116.01052653682115 -32.08146082320518,116.01058267280817 -32.081587605133265,116.01063142465802 -32.081729220922824,116.01068182001156 -32.08189829930168,116.01072290733572 -32.08206120630097),(116.01072237911988 -32.082058999272014,116.01077917811983 -32.08231030227197,116.01109078128283 -32.08383548299498),(116.01109086746756 -32.08383589977394,116.01137127446756 -32.08517589977395),(116.01137124856636 -32.08517408499261,116.01144284956632 -32.08551839299257,116.01156500619092 -32.086113755806224,116.01171377781402 -32.086851268098705,116.01180725401962 -32.08739687268617,116.01188271296475 -32.087827698396836,116.01197135514636 -32.08830829575098,116.01202227473344 -32.0885516055989),(116.01202239103694 -32.08855264437839,116.01212377503693 -32.08902284737834,116.01222471803518 -32.089422204933946,116.01232116453106 -32.08981491211969,116.01237357080474 -32.09001519903165,116.01245516018464 -32.09036092090208,116.01247705691942 -32.09047762036227),(115.95054377214113 -32.0277537011458,115.95074829314115 -32.02777252414582,115.95095341442416 -32.02779476529008,115.95185288545278 -32.027898681653824),(115.95185109777418 -32.0278984438386,115.95462799477419 -32.028278882838606),(115.95462802027689 -32.02827888783191,115.95776627227687 -32.02870752183191),(115.95776484026386 -32.02870732026478,115.95903818426385 -32.02890248726479),(115.96892798645315 -32.03736260135348,115.97038648145312 -32.03953371135347),(115.97038644211622 -32.039533712198605,115.97177044511622 -32.04159280919854),(115.97177109328115 -32.04159376031003,115.97272595298924 -32.042975803727124,115.97329380709137 -32.043814755822645),(115.97329233024854 -32.0438125018175,115.97331413524853 -32.0438468958175,115.97373802076874 -32.04447818242337),(115.97373801811631 -32.04447817847327,115.97423522211635 -32.04521867647323,115.97436148489635 -32.04541380547823,115.97457047690743 -32.045768861031256,115.97493214681745 -32.04632621217938,115.9751420632695 -32.04661465576031,115.97517934058645 -32.04666473872976),(115.97517816143635 -32.04666311732791,115.97520316743635 -32.046698321327874,115.97532025243257 -32.04685744231791,115.97553556024738 -32.047137730860385,115.97561308340948 -32.047230896787795,115.97578951507383 -32.04743109871419,115.97593872804131 -32.04758950506197,115.97605927527546 -32.04770406720742,115.97613037381365 -32.047765789539525,115.97633922117396 -32.04793569053944,115.97647328145707 -32.04803722497805,115.97659940853109 -32.048128325433396,115.97671895565298 -32.04820635907894,115.97697554186834 -32.04836147961747,115.97712433799684 -32.048443083286266,115.97725372113912 -32.048508641740156,115.97753403524158 -32.04864318786742),(115.9775362253921 -32.04864420295292,115.97764802739208 -32.048694206952916,115.9777551226393 -32.04873757700004,115.97894848551255 -32.04917644389399,115.98038098723116 -32.04974244906142),(115.98038133025207 -32.04974258378187,115.98148793025214 -32.05017457978184),(115.98148784675755 -32.05017454713908,115.98290995075753 -32.05073134613911),(115.9829104813591 -32.05073155195048,115.98314158235915 -32.050820350950445,115.98337652704014 -32.05091769308593,115.9836312082401 -32.05102650955015,115.98371681289996 -32.05107270739027,115.98385883329829 -32.051153165712606,115.9839333219703 -32.051196256577775),(115.98393327059657 -32.05119621249267,115.98420414559652 -32.05135332949266,115.98516831173667 -32.05193594395503,115.98533032672599 -32.05204325670665,115.9855228005169 -32.052204361704135,115.98570176392442 -32.05237507500433,115.98596004117411 -32.05264934808051),(116.00014871590072 -32.07005831953694,116.00051971790069 -32.07041201353694,116.00075739801004 -32.0706534301295,116.0008463160171 -32.07074738921568,116.00207634455167 -32.07192985572306,116.00211804813846 -32.07196762489647,116.00215448358863 -32.072003006742364,116.0022636402499 -32.07210388261699),(116.00226515393564 -32.07210524947067,116.00238355793562 -32.072209752470634,116.0025494309873 -32.07234164537451,116.00381967901251 -32.07333278619,116.00470931196506 -32.074013440521085),(116.00470843992856 -32.07401276480047,116.00532575353083 -32.07449720220619,116.00541282363267 -32.07458203779191,116.00663438833595 -32.07605289410581),(116.00663436221178 -32.07605286568538,116.00819385321175 -32.07793168468536,116.00847877921403 -32.078277849167996),(116.00847873061333 -32.078277790070594,116.00915048061337 -32.079095333070576,116.00930413634738 -32.07927137386997,116.0094544183283 -32.079458212881995,116.00959799973734 -32.079639978789224,116.00968185354726 -32.0797516372457))\",\"MULTIPOINT ((115.8018372737292 -31.890062043719624),(115.80208275968369 -31.88999214761082))\",\"MULTIPOINT ((115.85393141776753 -32.048215776792965),(115.85365425352151 -32.04809166414051))\"]\n" + ] + } + ], + "source": [ + "async with aiohttp.ClientSession() as session: \n", + " async with session.get(\n", + " f'http://127.0.0.1:8080/batch2/?{urlencode({**query_parameters, \"items\":json.dumps(query_parameters[\"items\"])})}'\n", + " ) as resp:\n", + " print(resp.status)\n", + " print(await resp.text())" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "format=wkt&items=%5B%7B%22road%22%3A+%22H001%22%2C+%22slk_from%22%3A+10%2C+%22slk_to%22%3A+20%2C+%22offset%22%3A+10%7D%2C+%7B%22road%22%3A+%22H016%22%2C+%22slk%22%3A+10%7D%2C+%7B%22road%22%3A+%22H015%22%2C+%22slk%22%3A+10%7D%5D\n" + ] + } + ], + "source": [ + "print(urlencode({**query_parameters, \"items\":json.dumps(query_parameters[\"items\"])}))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}