diff --git a/.gitignore b/.gitignore index 0b108f2..c20d2cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ node_modules web/public/ data_prep/inspire data_prep/local_inputs +test_cases/test_case_*_inspire_parcels.geojson +test_cases/test_case_*_inspire_parcels_27700.geojson diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 67f1986..8170165 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -198,6 +198,7 @@ dependencies = [ "geo", "geojson", "geozero", + "serde", "serde_json", "utils", "widths", @@ -1219,18 +1220,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index c31712a..edc5d92 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -10,6 +10,7 @@ flatgeobuf = { git = "https://github.com/michaelkirk/flatgeobuf/", branch = "mki geo = "0.28.0" geojson = { git = "https://github.com/georust/geojson", features = ["geo-types"] } geozero = { version = "0.13.0", default-features = false, features = ["with-geo"] } +serde = "1.0.210" serde_json = "1.0.117" utils = { git = "https://github.com/a-b-street/utils" } widths = { path = "../widths" } diff --git a/cli/src/lib.rs b/cli/src/lib.rs new file mode 100644 index 0000000..f7456cd --- /dev/null +++ b/cli/src/lib.rs @@ -0,0 +1,21 @@ +// Classifies Inspire polygons into "road space" and "non-road space" polygons. +// Where necessary it will subdivide polygons into smaller polygons. +// It will also attempt to classify the negative space between polygons. + + +use std::collections::HashSet; + +use serde::{Deserialize, Serialize}; + + +#[derive(Serialize, Deserialize)] +pub struct SourceInspirePolygons { + geometry: geojson::Geometry, +} + +pub fn classify_polygons_by_id( + _polygons: Vec +) -> (Option>, Option>) { + // TODO + unimplemented!(); +} \ No newline at end of file diff --git a/cli/tests/test_inspire_classifier.rs b/cli/tests/test_inspire_classifier.rs new file mode 100644 index 0000000..29f143b --- /dev/null +++ b/cli/tests/test_inspire_classifier.rs @@ -0,0 +1,134 @@ +use std::collections::HashSet; + +mod utils; + +use cli::{classify_polygons_by_id, SourceInspirePolygons}; + +use std::fs::File; +use std::io::BufReader; + + + +struct InspireClassificationExpectedResults { + case_id: usize, + road_space_polygons: Option>, + non_road_space_polygons: Option>, +} + +fn get_expected_results() -> Vec { + // See `test_cases.md`` for details + vec![ + InspireClassificationExpectedResults { + case_id: 1, + road_space_polygons: Some(HashSet::from([ + 25855822, + 25852274, + 25853082, + 25857333, + 25853200, + 25853129, + 25853929, + ])), + non_road_space_polygons: None, + }, + InspireClassificationExpectedResults { + case_id: 3, + road_space_polygons: Some(HashSet::from([ + 25809009, + ])), + non_road_space_polygons: Some(HashSet::from([ + 25803085, + 25803248, + 54395749, + ])), + }, + InspireClassificationExpectedResults { + case_id: 5, + road_space_polygons: Some(HashSet::from([ + 25826568, + ])), + non_road_space_polygons: None + }, + ] +} + + +fn read_test_case_source_polygons(case_id: usize) -> Result, geojson::Error> { + // let f_name = format!("test_case_{}", case_id); + let f_path = format!("test_cases/test_case_{}_inspire_parcels.geojson", case_id); + let f_path = utils::get_test_file_path(f_path).unwrap(); + dbg!("Reading test case source polygons from: {}", f_path.clone()); + + let file_reader = BufReader::new(File::open(f_path)?); + + geojson::de::deserialize_feature_collection_to_vec::(file_reader) +} + +fn check_expected_results( + expected_matches: &Option>, + expected_non_matches: &Option>, + actual_matches: &Option>, +) { + + // Handle cases where either the expected or actual results are `None` + match (expected_matches, actual_matches) { + (None, _) => { + // Both are `None`, so we're good + }, + (Some(expected), Some(actual)) => { + // We want to check that we've identified all the expected road space + // polygons, but our 'expected' list might not be exhaustive. + assert!( + actual.is_superset(&expected) + ) + }, + (Some(_), None) => { + assert!(false, "Expected and actual road space polygons do not match"); + } + + } + + // Check that we have mis-classified any road space polygons + match (expected_non_matches, actual_matches) { + (Some(expected), Some(actual)) => { + assert!( + actual.is_disjoint(&expected) + ) + }, + _ => { + // We're good + } + } + +} + + +#[test] +fn test_classify_group_a() { + + let expected_results = get_expected_results(); + + for case in expected_results.iter() { + let case_id = case.case_id; + let expected_road_space_ids = &case.road_space_polygons; + let expected_non_road_space_ids = &case.non_road_space_polygons; + + let source_polygons = read_test_case_source_polygons(case_id).unwrap(); + let (actual_road_space, actual_non_road_space) = classify_polygons_by_id(source_polygons); + + // Check the road space polygons + check_expected_results( + &expected_road_space_ids, + &expected_non_road_space_ids, + &actual_road_space + ); + + // Check the non-road space polygons + check_expected_results( + &expected_non_road_space_ids, + &expected_road_space_ids, + &actual_non_road_space + ); + } + +} \ No newline at end of file diff --git a/cli/tests/utils.rs b/cli/tests/utils.rs new file mode 100644 index 0000000..53a52c3 --- /dev/null +++ b/cli/tests/utils.rs @@ -0,0 +1,45 @@ +use std::path::PathBuf; + +use anyhow::{anyhow, Result}; + +/// Obtains a path to a test file (test code only!) +/// This is a convenience function for writing test code. It allow tests code from anywhere in the +/// workspace to access test files (eg input .osm files, golden outputfiles etc) which are stored within +/// the `tests` package. +/// This function make direct reference to the location of this source file (using the `file!()` marco) +/// and hence should only be used in test code and not in any production code. +// Copied from here: +// https://github.com/a-b-street/abstreet/blob/d30c36a22a87824d3581e0d0d4e2faf9788d6176/tests/src/lib.rs#L29 +pub fn get_test_file_path(path: String) -> Result { + // Get the absolute path to the crate that called was invoked at the cli (or equivalent) + let maybe_workspace_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + let maybe_workspace_dir = std::path::Path::new(&maybe_workspace_dir); + // Get the relative path to this source file within the workspace + let this_source_file = String::from(file!()); + + // Try a find a suitable way to join the two paths to find something that exists + let test_file = next_test_file_path(maybe_workspace_dir, &this_source_file); + if test_file.is_ok() { + // Now try and match the workspace path with the user requested path + match next_test_file_path(test_file.as_ref().unwrap(), &path) { + Ok(pb) => Ok(String::from(pb.to_str().unwrap())), + Err(e) => Err(e), + } + } else { + panic!("Cannot find the absolute path to {}. Check that this function being called from test code, not production code.", this_source_file); + } +} + +fn next_test_file_path( + maybe_absolute_dir: &std::path::Path, + file_path: &String, +) -> Result { + let path_to_test = maybe_absolute_dir.join(file_path); + if path_to_test.exists() { + Ok(path_to_test) + } else if maybe_absolute_dir.parent().is_some() { + next_test_file_path(maybe_absolute_dir.parent().unwrap(), file_path) + } else { + Err(anyhow!("Cannot locate file '{}'", file_path)) + } +} diff --git a/test_cases/get_test_data.sh b/test_cases/get_test_data.sh new file mode 100755 index 0000000..17b40d6 --- /dev/null +++ b/test_cases/get_test_data.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# This is just a convenience to download a subset of the data for test purposes. + +set -e +set -x + +this_dir=$(dirname $0) +AREA=Newcastle_City_Council +mkdir -p $AREA +pushd $AREA + +wget https://use-land-property-data.service.gov.uk/datasets/inspire/download/$AREA.zip +unzip $AREA.zip Land_Registry_Cadastral_Parcels.gml + +# Convert GML to GeoJSON, dropping all properties and fixing the coordinate system. +# See +# https://gis.stackexchange.com/questions/442709/how-can-i-debug-hanging-ogr2ogr +# for the amusing story of ignoring an unreachable schema in the GML. +ogr2ogr v1.geojson -oo DOWNLOAD_SCHEMA=NO Land_Registry_Cadastral_Parcels.gml -sql 'SELECT geometry FROM PREDEFINED' + +popd + +# Get the bounding boxes for all test cases +test_case_bboxes=`find $this_dir -type f -name "test_case_*_bounding_box.geojson"` + +# Create a parcel file for each test case +for test_case_bbox in $test_case_bboxes; do + intermediate_file="${test_case_bbox/bounding_box/inspire_parcels_27700}" + output_file="${test_case_bbox/bounding_box/inspire_parcels}" + + mapshaper $AREA/v1.geojson -clip $test_case_bbox -o $intermediate_file format=geojson geojson-type=FeatureCollection + # Convert to WGS84 + ogr2ogr $output_file -s_srs EPSG:27700 -t_srs EPSG:4326 $intermediate_file +done + +# Clean up intermediate files +rm -rf $AREA diff --git a/test_cases/test_case_1_bounding_box.geojson b/test_cases/test_case_1_bounding_box.geojson new file mode 100644 index 0000000..1152d44 --- /dev/null +++ b/test_cases/test_case_1_bounding_box.geojson @@ -0,0 +1,8 @@ +{ +"type": "FeatureCollection", +"name": "test_case_1_bounding_box", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 424240, 568880 ], [ 424340, 568880 ], [ 424340, 570021 ], [ 424240, 570021 ], [ 424240, 568880 ] ] ] } } +] +} diff --git a/test_cases/test_case_2_bounding_box.geojson b/test_cases/test_case_2_bounding_box.geojson new file mode 100644 index 0000000..8d6c04d --- /dev/null +++ b/test_cases/test_case_2_bounding_box.geojson @@ -0,0 +1,8 @@ +{ +"type": "FeatureCollection", +"name": "test_case_2_bounding_box", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { "test_case_name": "test_case_2", "width": 100.701894, "height": 186.276894, "area": 18758.436017, "perimeter": 573.957576 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 424336.028977272857446, 569400.797348484862596 ], [ 424436.730871212144848, 569400.797348484862596 ], [ 424436.730871212144848, 569587.074242424103431 ], [ 424336.028977272857446, 569587.074242424103431 ], [ 424336.028977272857446, 569400.797348484862596 ] ] ] } } +] +} diff --git a/test_cases/test_case_2_expected_non_road_space.geojson b/test_cases/test_case_2_expected_non_road_space.geojson new file mode 100644 index 0000000..34a0680 --- /dev/null +++ b/test_cases/test_case_2_expected_non_road_space.geojson @@ -0,0 +1,10 @@ +{ +"type": "FeatureCollection", +"name": "test_case_2_missing_ploygons", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { "test_case_name": "case_2_missingploygon_1" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 424379.729999999981374, 569436.569999999948777 ], [ 424376.049999999988358, 569426.300000000046566 ], [ 424415.89000000001397, 569425.699999999953434 ], [ 424416.039999999979045, 569434.199999999953434 ], [ 424416.07, 569435.75 ], [ 424379.729999999981374, 569436.569999999948777 ] ] ] } }, +{ "type": "Feature", "properties": { "test_case_name": "case_2_missingploygon_2" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 424349.349999999976717, 569478.400000000023283 ], [ 424349.349999999976717, 569478.400000000023283 ], [ 424346.71999999997206, 569473.63 ], [ 424375.51, 569456.900000000023283 ], [ 424379.14000000001397, 569471.949999999953434 ], [ 424358.200000000011642, 569477.900000000023283 ], [ 424349.349999999976717, 569478.400000000023283 ] ] ] } }, +{ "type": "Feature", "properties": { "test_case_name": "case_2_missingploygon_3" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 424390.25, 569495.550000000046566 ], [ 424395.349999999976717, 569512.449999999953434 ], [ 424417.88, 569498.189999999944121 ], [ 424417.549999999988358, 569497.699999999953434 ], [ 424417.479999999981374, 569494.800000000046566 ], [ 424390.25, 569495.550000000046566 ] ] ] } } +] +} diff --git a/test_cases/test_case_3_bounding_box.geojson b/test_cases/test_case_3_bounding_box.geojson new file mode 100644 index 0000000..d8be715 --- /dev/null +++ b/test_cases/test_case_3_bounding_box.geojson @@ -0,0 +1,8 @@ +{ +"type": "FeatureCollection", +"name": "test_case_3_bounding_box", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f00", "INSPIREID": 25809009, "LABEL": 25809009, "NATIONALCADASTRALREFERENCE": 25809009, "VALIDFROM": "2009-01-19T11:45:10.845Z", "BEGINLIFESPANVERSION": "2009-01-19T11:45:10.845Z", "width": 217.24, "height": 171.977, "area": 37360.28348, "perimeter": 778.434 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423592.450000000011642, 568216.292999999946915 ], [ 423809.69, 568216.292999999946915 ], [ 423809.69, 568388.270000000018626 ], [ 423592.450000000011642, 568388.270000000018626 ], [ 423592.450000000011642, 568216.292999999946915 ] ] ] } } +] +} diff --git a/test_cases/test_case_4_bounding_box.geojson b/test_cases/test_case_4_bounding_box.geojson new file mode 100644 index 0000000..e80f99d --- /dev/null +++ b/test_cases/test_case_4_bounding_box.geojson @@ -0,0 +1,25 @@ +{ + "type": "FeatureCollection", + "name": "test_case_4_bounding_box", + "crs": { + "type": "name", + "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } + }, + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [423263, 568241], + [423623, 568241], + [423623, 568456], + [423263, 568456], + [423263, 568241] + ] + ] + } + } + ] +} diff --git a/test_cases/test_case_4_expected_non_road_space.geojson b/test_cases/test_case_4_expected_non_road_space.geojson new file mode 100644 index 0000000..b17c529 --- /dev/null +++ b/test_cases/test_case_4_expected_non_road_space.geojson @@ -0,0 +1,31 @@ +{ +"type": "FeatureCollection", +"name": "test_case_4_expected_non_road_space", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423438.099999999976717, 568291.400000000023283 ], [ 423444.900000000023283, 568293.099999999976717 ], [ 423445.950000000011642, 568288.540000000037253 ], [ 423447.710000000020955, 568281.199999999953434 ], [ 423451.849999999976717, 568266.209999999962747 ], [ 423443.5, 568264.050000000046566 ], [ 423435.549999999988358, 568261.949999999953434 ], [ 423433.270000000018626, 568261.39000000001397 ], [ 423428.200000000011642, 568260.150000000023283 ], [ 423426.99, 568259.92000000004191 ], [ 423425.299999999988358, 568259.64000000001397 ], [ 423423.299999999988358, 568286.75 ], [ 423423.299999999988358, 568287.099999999976717 ], [ 423423.349999999976717, 568287.550000000046566 ], [ 423423.450000000011642, 568288.150000000023283 ], [ 423424.0, 568288.25 ], [ 423427.5, 568288.800000000046566 ], [ 423430.950000000011642, 568289.650000000023283 ], [ 423438.099999999976717, 568291.400000000023283 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423464.75, 568339.060000000055879 ], [ 423465.099999999976717, 568335.849999999976717 ], [ 423459.900000000023283, 568334.5 ], [ 423452.87, 568332.660000000032596 ], [ 423445.950000000011642, 568330.849999999976717 ], [ 423438.5, 568328.949999999953434 ], [ 423431.049999999988358, 568327.089999999967404 ], [ 423427.349999999976717, 568334.050000000046566 ], [ 423430.82, 568340.839999999967404 ], [ 423433.919999999983702, 568339.75 ], [ 423440.89000000001397, 568337.300000000046566 ], [ 423442.049999999988358, 568337.599999999976717 ], [ 423448.25, 568338.150000000023283 ], [ 423449.450000000011642, 568338.300000000046566 ], [ 423450.700000000011642, 568338.400000000023283 ], [ 423452.549999999988358, 568338.5 ], [ 423454.450000000011642, 568338.550000000046566 ], [ 423458.549999999988358, 568338.650000000023283 ], [ 423464.75, 568339.060000000055879 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423488.900000000023283, 568345.050000000046566 ], [ 423481.0, 568351.5 ], [ 423483.349999999976717, 568356.0 ], [ 423484.75, 568358.949999999953434 ], [ 423487.200000000011642, 568363.25 ], [ 423487.400000000023283, 568363.550000000046566 ], [ 423487.549999999988358, 568363.949999999953434 ], [ 423487.950000000011642, 568365.550000000046566 ], [ 423488.150000000023283, 568366.550000000046566 ], [ 423488.349999999976717, 568367.650000000023283 ], [ 423488.549999999988358, 568368.949999999953434 ], [ 423488.650000000023283, 568370.300000000046566 ], [ 423488.900000000023283, 568371.949999999953434 ], [ 423489.150000000023283, 568373.650000000023283 ], [ 423489.349999999976717, 568377.75 ], [ 423489.549999999988358, 568380.849999999976717 ], [ 423489.650000000023283, 568382.300000000046566 ], [ 423492.63, 568380.819999999948777 ], [ 423500.0, 568377.150000000023283 ], [ 423500.62, 568376.839999999967404 ], [ 423501.020000000018626, 568376.64000000001397 ], [ 423508.789999999979045, 568372.78000000002794 ], [ 423510.650000000023283, 568371.849999999976717 ], [ 423516.94, 568368.71999999997206 ], [ 423520.900000000023283, 568366.75 ], [ 423515.12, 568360.459999999962747 ], [ 423509.960000000020955, 568355.01 ], [ 423500.0, 568350.75 ], [ 423490.549999999988358, 568346.300000000046566 ], [ 423488.900000000023283, 568345.050000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423477.849999999976717, 568351.849999999976717 ], [ 423474.0, 568351.599999999976717 ], [ 423472.299999999988358, 568359.550000000046566 ], [ 423471.900000000023283, 568361.650000000023283 ], [ 423471.450000000011642, 568363.699999999953434 ], [ 423470.950000000011642, 568365.699999999953434 ], [ 423470.400000000023283, 568367.699999999953434 ], [ 423469.799999999988358, 568370.050000000046566 ], [ 423469.299999999988358, 568372.449999999953434 ], [ 423465.900000000023283, 568385.050000000046566 ], [ 423463.039999999979045, 568395.569999999948777 ], [ 423468.0, 568393.199999999953434 ], [ 423476.080000000016298, 568389.160000000032596 ], [ 423478.539999999979045, 568387.910000000032596 ], [ 423479.049999999988358, 568373.160000000032596 ], [ 423479.5, 568365.5 ], [ 423478.900000000023283, 568361.050000000046566 ], [ 423478.75, 568360.25 ], [ 423478.599999999976717, 568359.400000000023283 ], [ 423478.5, 568358.5 ], [ 423478.400000000023283, 568357.550000000046566 ], [ 423478.200000000011642, 568356.849999999976717 ], [ 423478.099999999976717, 568356.050000000046566 ], [ 423478.0, 568355.400000000023283 ], [ 423477.950000000011642, 568354.75 ], [ 423477.849999999976717, 568353.550000000046566 ], [ 423477.849999999976717, 568351.849999999976717 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423459.06, 568306.17000000004191 ], [ 423451.75, 568304.349999999976717 ], [ 423448.25, 568320.0 ], [ 423445.950000000011642, 568330.849999999976717 ], [ 423452.87, 568332.660000000032596 ], [ 423456.26, 568317.88 ], [ 423458.049999999988358, 568310.5 ], [ 423459.06, 568306.17000000004191 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423437.049999999988358, 568300.699999999953434 ], [ 423429.78000000002794, 568298.88 ], [ 423428.830000000016298, 568303.569999999948777 ], [ 423427.330000000016298, 568310.729999999981374 ], [ 423425.450000000011642, 568325.699999999953434 ], [ 423431.049999999988358, 568327.089999999967404 ], [ 423436.099999999976717, 568305.050000000046566 ], [ 423437.049999999988358, 568300.699999999953434 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423414.299999999988358, 568297.300000000046566 ], [ 423398.950000000011642, 568298.050000000046566 ], [ 423399.549999999988358, 568302.540000000037253 ], [ 423400.400000000023283, 568309.92000000004191 ], [ 423402.659999999974389, 568329.53000000002794 ], [ 423406.700000000011642, 568330.199999999953434 ], [ 423407.330000000016298, 568330.319999999948777 ], [ 423411.0, 568330.99 ], [ 423413.200000000011642, 568331.400000000023283 ], [ 423413.75, 568321.900000000023283 ], [ 423413.950000000011642, 568310.75 ], [ 423414.299999999988358, 568303.07999999995809 ], [ 423414.299999999988358, 568297.300000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423400.549999999988358, 568288.599999999976717 ], [ 423415.599999999976717, 568287.60999999998603 ], [ 423415.599999999976717, 568283.13 ], [ 423415.650000000023283, 568275.650000000023283 ], [ 423416.039999999979045, 568257.99 ], [ 423408.830000000016298, 568256.839999999967404 ], [ 423407.0, 568256.550000000046566 ], [ 423406.799999999988358, 568256.520000000018626 ], [ 423396.650000000023283, 568255.0 ], [ 423398.85999999998603, 568274.800000000046566 ], [ 423399.700000000011642, 568282.26 ], [ 423400.549999999988358, 568288.599999999976717 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423437.950000000011642, 568355.32999999995809 ], [ 423440.57, 568360.459999999962747 ], [ 423443.96999999997206, 568357.53000000002794 ], [ 423449.099999999976717, 568352.050000000046566 ], [ 423457.599999999976717, 568348.849999999976717 ], [ 423466.099999999976717, 568345.699999999953434 ], [ 423464.93, 568342.53000000002794 ], [ 423461.349999999976717, 568343.099999999976717 ], [ 423459.700000000011642, 568343.349999999976717 ], [ 423458.099999999976717, 568343.550000000046566 ], [ 423456.599999999976717, 568343.75 ], [ 423455.099999999976717, 568343.900000000023283 ], [ 423452.950000000011642, 568344.150000000023283 ], [ 423450.849999999976717, 568344.349999999976717 ], [ 423443.849999999976717, 568345.050000000046566 ], [ 423435.479999999981374, 568350.410000000032596 ], [ 423436.299999999988358, 568352.099999999976717 ], [ 423437.950000000011642, 568355.32999999995809 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423449.299999999988358, 568430.199999999953434 ], [ 423471.650000000023283, 568421.949999999953434 ], [ 423464.950000000011642, 568408.150000000023283 ], [ 423459.85999999998603, 568397.270000000018626 ], [ 423459.400000000023283, 568397.5 ], [ 423458.87, 568399.39000000001397 ], [ 423458.75, 568399.800000000046566 ], [ 423455.400000000023283, 568410.660000000032596 ], [ 423453.039999999979045, 568418.540000000037253 ], [ 423450.200000000011642, 568428.349999999976717 ], [ 423450.099999999976717, 568428.800000000046566 ], [ 423450.0, 568429.099999999976717 ], [ 423449.849999999976717, 568429.5 ], [ 423449.650000000023283, 568429.849999999976717 ], [ 423449.299999999988358, 568430.199999999953434 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423434.479999999981374, 568408.800000000046566 ], [ 423437.830000000016298, 568415.650000000023283 ], [ 423443.0, 568412.150000000023283 ], [ 423447.799999999988358, 568409.199999999953434 ], [ 423446.460000000020955, 568407.13 ], [ 423447.549999999988358, 568406.449999999953434 ], [ 423446.06, 568404.21999999997206 ], [ 423444.75, 568402.25 ], [ 423439.950000000011642, 568405.199999999953434 ], [ 423434.479999999981374, 568408.800000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423374.909999999974389, 568348.979999999981374 ], [ 423385.200000000011642, 568361.57999999995809 ], [ 423386.450000000011642, 568359.430000000051223 ], [ 423391.21999999997206, 568351.199999999953434 ], [ 423394.299999999988358, 568345.800000000046566 ], [ 423393.549999999988358, 568345.310000000055879 ], [ 423393.0, 568344.949999999953434 ], [ 423377.520000000018626, 568348.46999999997206 ], [ 423374.909999999974389, 568348.979999999981374 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423356.700000000011642, 568308.89000000001397 ], [ 423350.659999999974389, 568280.209999999962747 ], [ 423346.080000000016298, 568281.24 ], [ 423338.770000000018626, 568282.699999999953434 ], [ 423323.21999999997206, 568286.069999999948777 ], [ 423326.289999999979045, 568300.46999999997206 ], [ 423327.770000000018626, 568307.35999999998603 ], [ 423329.31, 568314.569999999948777 ], [ 423344.71999999997206, 568311.37 ], [ 423352.12, 568309.85999999998603 ], [ 423356.700000000011642, 568308.89000000001397 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423336.87599999998929, 568349.675000000046566 ], [ 423342.60326481849188, 568349.380086636403576 ], [ 423365.389907034230419, 568354.322541426867247 ], [ 423359.71999999997206, 568323.21999999997206 ], [ 423353.75, 568324.5 ], [ 423346.419999999983702, 568326.01 ], [ 423341.849999999976717, 568327.150000000023283 ], [ 423340.099999999976717, 568327.650000000023283 ], [ 423338.299999999988358, 568328.150000000023283 ], [ 423336.75, 568328.449999999953434 ], [ 423335.25, 568328.849999999976717 ], [ 423334.450000000011642, 568329.050000000046566 ], [ 423333.700000000011642, 568329.25 ], [ 423332.5, 568329.520000000018626 ], [ 423333.87, 568335.939999999944121 ], [ 423335.400000000023283, 568343.099999999976717 ], [ 423336.118000000016764, 568346.378999999957159 ], [ 423336.378000000026077, 568347.511000000056811 ], [ 423336.87599999998929, 568349.675000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423353.720221177733038, 568248.411537546780892 ], [ 423356.0, 568259.349999999976717 ], [ 423360.299999999988358, 568258.449999999953434 ], [ 423367.60999999998603, 568257.050000000046566 ], [ 423374.0, 568256.449999999953434 ], [ 423382.099999999976717, 568255.800000000046566 ], [ 423382.299999999988358, 568255.75 ], [ 423382.5, 568255.75 ], [ 423382.75, 568255.699999999953434 ], [ 423383.450000000011642, 568255.699999999953434 ], [ 423383.650000000023283, 568255.650000000023283 ], [ 423383.849999999976717, 568255.550000000046566 ], [ 423384.0, 568255.550000000046566 ], [ 423384.099999999976717, 568255.5 ], [ 423384.51, 568255.39000000001397 ], [ 423384.450000000011642, 568253.099999999976717 ], [ 423367.549999999988358, 568250.550000000046566 ], [ 423359.900000000023283, 568249.25 ], [ 423353.720221177733038, 568248.411537546780892 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423467.700000000011642, 568298.800000000046566 ], [ 423482.200000000011642, 568302.5 ], [ 423489.25, 568275.5 ], [ 423481.75, 568273.650000000023283 ], [ 423474.21999999997206, 568271.810000000055879 ], [ 423467.700000000011642, 568298.800000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423553.64000000001397, 568380.979999999981374 ], [ 423562.06, 568376.810000000055879 ], [ 423559.210000000020955, 568371.319999999948777 ], [ 423555.53000000002794, 568364.01 ], [ 423549.53000000002794, 568352.26 ], [ 423542.169999999983702, 568355.88 ], [ 423541.549999999988358, 568356.449999999953434 ], [ 423541.450000000011642, 568356.5 ], [ 423553.64000000001397, 568380.979999999981374 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423499.549999999988358, 568307.099999999976717 ], [ 423508.599999999976717, 568309.400000000023283 ], [ 423509.85999999998603, 568304.930000000051223 ], [ 423511.63, 568297.88 ], [ 423515.78000000002794, 568282.729999999981374 ], [ 423506.349999999976717, 568280.26 ], [ 423500.0, 568305.650000000023283 ], [ 423499.549999999988358, 568307.099999999976717 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423549.19, 568328.959999999962747 ], [ 423540.159999999974389, 568326.689999999944121 ], [ 423536.599999999976717, 568341.349999999976717 ], [ 423535.400000000023283, 568345.900000000023283 ], [ 423533.669999999983702, 568353.67000000004191 ], [ 423542.169999999983702, 568355.88 ], [ 423546.330000000016298, 568340.53000000002794 ], [ 423546.599999999976717, 568340.589999999967404 ], [ 423548.24, 568333.339999999967404 ], [ 423549.19, 568328.959999999962747 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423570.729999999981374, 568325.0 ], [ 423579.75, 568327.270000000018626 ], [ 423580.78000000002794, 568322.939999999944121 ], [ 423582.590000000025611, 568315.85999999998603 ], [ 423586.5, 568300.62 ], [ 423577.44, 568298.319999999948777 ], [ 423575.60999999998603, 568305.599999999976717 ], [ 423574.460000000020955, 568310.17000000004191 ], [ 423570.729999999981374, 568325.0 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423587.799999999988358, 568329.300000000046566 ], [ 423595.900000000023283, 568331.400000000023283 ], [ 423591.318000000028405, 568316.397 ], [ 423590.700000000011642, 568318.900000000023283 ], [ 423587.799999999988358, 568329.300000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423440.57, 568360.459999999962747 ], [ 423437.950000000011642, 568355.32999999995809 ], [ 423422.099999999976717, 568372.099999999976717 ], [ 423413.099999999976717, 568381.650000000023283 ], [ 423419.46999999997206, 568387.770000000018626 ], [ 423423.93, 568383.46999999997206 ], [ 423429.049999999988358, 568378.550000000046566 ], [ 423443.049999999988358, 568365.319999999948777 ], [ 423442.150000000023283, 568363.550000000046566 ], [ 423440.57, 568360.459999999962747 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423391.450000000011642, 568298.949999999953434 ], [ 423365.325719309737906, 568304.063553102896549 ], [ 423367.200000000011642, 568313.300000000046566 ], [ 423371.71999999997206, 568312.180000000051223 ], [ 423379.099999999976717, 568310.540000000037253 ], [ 423391.700000000011642, 568307.949999999953434 ], [ 423393.400000000023283, 568307.300000000046566 ], [ 423391.450000000011642, 568298.949999999953434 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423570.150000000023283, 568372.800000000046566 ], [ 423593.994488024211023, 568361.062252504634671 ], [ 423582.697448503167834, 568338.083047115243971 ], [ 423557.31, 568331.0 ], [ 423556.150000000023283, 568335.449999999953434 ], [ 423554.700000000011642, 568340.849999999976717 ], [ 423557.099999999976717, 568341.5 ], [ 423559.450000000011642, 568342.13 ], [ 423558.049999999988358, 568348.0 ], [ 423557.659999999974389, 568348.21999999997206 ], [ 423570.150000000023283, 568372.800000000046566 ] ] ] } } +] +} diff --git a/test_cases/test_case_4_expected_road_space.geojson b/test_cases/test_case_4_expected_road_space.geojson new file mode 100644 index 0000000..c43a075 --- /dev/null +++ b/test_cases/test_case_4_expected_road_space.geojson @@ -0,0 +1,9 @@ +{ +"type": "FeatureCollection", +"name": "test_case_4_expected_road_space", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1bab", "INSPIREID": 25782300, "LABEL": 25782300, "NATIONALCADASTRALREFERENCE": 25782300, "VALIDFROM": "2009-01-22T00:00:00Z", "BEGINLIFESPANVERSION": "2023-07-08T08:08:35.683Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423367.200000000011642, 568313.300000000046566 ], [ 423365.325719309737906, 568304.063553102896549 ], [ 423391.450000000011642, 568298.949999999953434 ], [ 423395.150000000023283, 568298.5 ], [ 423398.950000000011642, 568298.050000000046566 ], [ 423414.299999999988358, 568297.300000000046566 ], [ 423418.349999999976717, 568297.550000000046566 ], [ 423422.349999999976717, 568297.949999999953434 ], [ 423425.900000000023283, 568298.349999999976717 ], [ 423429.400000000023283, 568298.800000000046566 ], [ 423429.78000000002794, 568298.88 ], [ 423437.049999999988358, 568300.699999999953434 ], [ 423444.38, 568302.520000000018626 ], [ 423451.75, 568304.349999999976717 ], [ 423459.06, 568306.17000000004191 ], [ 423466.599999999976717, 568308.050000000046566 ], [ 423473.99, 568309.849999999976717 ], [ 423481.200000000011642, 568311.599999999976717 ], [ 423476.75, 568329.449999999953434 ], [ 423475.07, 568329.069999999948777 ], [ 423472.44, 568328.32999999995809 ], [ 423469.599999999976717, 568327.550000000046566 ], [ 423468.25, 568332.949999999953434 ], [ 423467.299999999988358, 568336.349999999976717 ], [ 423465.099999999976717, 568335.849999999976717 ], [ 423464.75, 568339.060000000055879 ], [ 423464.700000000011642, 568340.349999999976717 ], [ 423464.799999999988358, 568341.599999999976717 ], [ 423464.93, 568342.53000000002794 ], [ 423466.099999999976717, 568345.699999999953434 ], [ 423466.799999999988358, 568346.800000000046566 ], [ 423467.599999999976717, 568347.75 ], [ 423468.299999999988358, 568348.5 ], [ 423469.549999999988358, 568349.449999999953434 ], [ 423470.900000000023283, 568350.300000000046566 ], [ 423471.200000000011642, 568350.449999999953434 ], [ 423472.25, 568351.0 ], [ 423473.400000000023283, 568351.400000000023283 ], [ 423474.0, 568351.599999999976717 ], [ 423477.849999999976717, 568351.849999999976717 ], [ 423479.049999999988358, 568351.800000000046566 ], [ 423480.200000000011642, 568351.650000000023283 ], [ 423481.0, 568351.5 ], [ 423488.900000000023283, 568345.050000000046566 ], [ 423489.549999999988358, 568343.849999999976717 ], [ 423490.049999999988358, 568342.599999999976717 ], [ 423490.200000000011642, 568342.17000000004191 ], [ 423489.200000000011642, 568341.949999999953434 ], [ 423490.0, 568338.28000000002794 ], [ 423491.5, 568332.800000000046566 ], [ 423488.900000000023283, 568332.01 ], [ 423486.349999999976717, 568331.339999999967404 ], [ 423483.78000000002794, 568330.67000000004191 ], [ 423482.950000000011642, 568330.449999999953434 ], [ 423487.549999999988358, 568313.199999999953434 ], [ 423496.32, 568315.520000000018626 ], [ 423500.0, 568316.5 ], [ 423505.06, 568317.85999999998603 ], [ 423513.71999999997206, 568320.180000000051223 ], [ 423522.539999999979045, 568322.32999999995809 ], [ 423523.085000000020955, 568320.214999999967404 ], [ 423523.697999999974854, 568317.834999999962747 ], [ 423523.715000000025611, 568317.770000000018626 ], [ 423507.653999999980442, 568313.84499999997206 ], [ 423502.150000000023283, 568312.5 ], [ 423501.988000000012107, 568312.435999999986961 ], [ 423500.0, 568311.650000000023283 ], [ 423485.299999999988358, 568307.849999999976717 ], [ 423441.099999999976717, 568297.0 ], [ 423440.400000000023283, 568296.849999999976717 ], [ 423437.188000000023749, 568296.015999999945052 ], [ 423437.729, 568293.278999999980442 ], [ 423438.099999999976717, 568291.400000000023283 ], [ 423430.950000000011642, 568289.650000000023283 ], [ 423427.5, 568288.800000000046566 ], [ 423424.0, 568288.25 ], [ 423423.450000000011642, 568288.150000000023283 ], [ 423420.25, 568287.800000000046566 ], [ 423417.099999999976717, 568287.599999999976717 ], [ 423415.75, 568287.599999999976717 ], [ 423415.599999999976717, 568287.60999999998603 ], [ 423400.549999999988358, 568288.599999999976717 ], [ 423392.549999999988358, 568289.300000000046566 ], [ 423387.150000000023283, 568289.949999999953434 ], [ 423385.650000000023283, 568290.099999999976717 ], [ 423384.200000000011642, 568290.300000000046566 ], [ 423383.099999999976717, 568290.449999999953434 ], [ 423382.099999999976717, 568290.599999999976717 ], [ 423380.799999999988358, 568290.800000000046566 ], [ 423379.549999999988358, 568291.050000000046566 ], [ 423378.0, 568291.449999999953434 ], [ 423376.349999999976717, 568291.849999999976717 ], [ 423367.849999999976717, 568294.0 ], [ 423367.299999999988358, 568294.199999999953434 ], [ 423366.700000000011642, 568294.300000000046566 ], [ 423366.25, 568294.400000000023283 ], [ 423365.75, 568294.449999999953434 ], [ 423365.25, 568294.400000000023283 ], [ 423364.75, 568294.25 ], [ 423364.299999999988358, 568294.050000000046566 ], [ 423363.849999999976717, 568293.75 ], [ 423363.599999999976717, 568293.5 ], [ 423363.5, 568293.199999999953434 ], [ 423363.200000000011642, 568292.699999999953434 ], [ 423363.099999999976717, 568292.150000000023283 ], [ 423362.0, 568286.949999999953434 ], [ 423360.400000000023283, 568280.300000000046566 ], [ 423358.950000000011642, 568273.57999999995809 ], [ 423357.450000000011642, 568266.599999999976717 ], [ 423356.0, 568259.349999999976717 ], [ 423353.720221177733038, 568248.411537546780892 ], [ 423349.950000000011642, 568247.900000000023283 ], [ 423348.830000000016298, 568247.790000000037253 ], [ 423347.900000000023283, 568247.449999999953434 ], [ 423345.049999999988358, 568247.0 ], [ 423344.789999999979045, 568246.959999999962747 ], [ 423330.25, 568244.650000000023283 ], [ 423318.31, 568242.71999999997206 ], [ 423316.349999999976717, 568242.400000000023283 ], [ 423313.809, 568241.986000000033528 ], [ 423316.06, 568252.535000000032596 ], [ 423316.799999999988358, 568256.0 ], [ 423316.799999999988358, 568255.349999999976717 ], [ 423316.849999999976717, 568255.199999999953434 ], [ 423316.900000000023283, 568254.949999999953434 ], [ 423317.0, 568254.599999999976717 ], [ 423317.099999999976717, 568254.400000000023283 ], [ 423317.200000000011642, 568254.25 ], [ 423317.299999999988358, 568254.0 ], [ 423317.450000000011642, 568253.699999999953434 ], [ 423317.5, 568253.550000000046566 ], [ 423317.599999999976717, 568253.400000000023283 ], [ 423317.700000000011642, 568253.150000000023283 ], [ 423317.75, 568252.949999999953434 ], [ 423318.01, 568252.770000000018626 ], [ 423318.299999999988358, 568252.400000000023283 ], [ 423318.700000000011642, 568252.0 ], [ 423318.950000000011642, 568251.800000000046566 ], [ 423319.200000000011642, 568251.650000000023283 ], [ 423319.450000000011642, 568251.550000000046566 ], [ 423319.950000000011642, 568251.300000000046566 ], [ 423320.299999999988358, 568251.199999999953434 ], [ 423320.75, 568251.050000000046566 ], [ 423321.25, 568251.0 ], [ 423321.650000000023283, 568251.0 ], [ 423322.0, 568251.050000000046566 ], [ 423322.450000000011642, 568251.050000000046566 ], [ 423322.849999999976717, 568251.099999999976717 ], [ 423338.950000000011642, 568253.449999999953434 ], [ 423339.5, 568253.5 ], [ 423340.099999999976717, 568253.599999999976717 ], [ 423340.75, 568253.699999999953434 ], [ 423341.450000000011642, 568253.900000000023283 ], [ 423341.950000000011642, 568254.050000000046566 ], [ 423342.450000000011642, 568254.25 ], [ 423343.049999999988358, 568254.550000000046566 ], [ 423343.700000000011642, 568254.900000000023283 ], [ 423344.349999999976717, 568255.349999999976717 ], [ 423344.849999999976717, 568255.949999999953434 ], [ 423345.299999999988358, 568256.550000000046566 ], [ 423345.700000000011642, 568257.199999999953434 ], [ 423345.900000000023283, 568257.650000000023283 ], [ 423346.049999999988358, 568258.199999999953434 ], [ 423346.25, 568259.0 ], [ 423346.400000000023283, 568259.800000000046566 ], [ 423347.650000000023283, 568265.949999999953434 ], [ 423349.14000000001397, 568273.040000000037253 ], [ 423350.659999999974389, 568280.209999999962747 ], [ 423356.700000000011642, 568308.89000000001397 ], [ 423358.18, 568315.92000000004191 ], [ 423359.71999999997206, 568323.21999999997206 ], [ 423365.389907034230419, 568354.322541426867247 ], [ 423342.60326481849188, 568349.380086636403576 ], [ 423336.87599999998929, 568349.675000000046566 ], [ 423338.224999999976717, 568355.518000000040047 ], [ 423338.401000000012573, 568356.278999999980442 ], [ 423341.439000000013039, 568356.082999999984168 ], [ 423342.75, 568356.099999999976717 ], [ 423347.849999999976717, 568356.900000000023283 ], [ 423349.5, 568357.25 ], [ 423355.349999999976717, 568358.449999999953434 ], [ 423361.25, 568359.949999999953434 ], [ 423366.950000000011642, 568361.75 ], [ 423367.549999999988358, 568361.949999999953434 ], [ 423372.650000000023283, 568363.900000000023283 ], [ 423377.700000000011642, 568366.050000000046566 ], [ 423382.549999999988358, 568368.5 ], [ 423383.5, 568369.0 ], [ 423387.900000000023283, 568371.550000000046566 ], [ 423392.200000000011642, 568374.25 ], [ 423396.349999999976717, 568377.199999999953434 ], [ 423398.950000000011642, 568379.099999999976717 ], [ 423400.913, 568380.687999999965541 ], [ 423403.400000000023283, 568382.699999999953434 ], [ 423407.75, 568386.5 ], [ 423410.450000000011642, 568389.050000000046566 ], [ 423414.114, 568392.714000000036322 ], [ 423409.641, 568396.381000000052154 ], [ 423407.849999999976717, 568397.849999999976717 ], [ 423409.200000000011642, 568399.449999999953434 ], [ 423410.5, 568401.050000000046566 ], [ 423411.75, 568402.599999999976717 ], [ 423413.049999999988358, 568404.099999999976717 ], [ 423414.099999999976717, 568405.400000000023283 ], [ 423415.150000000023283, 568406.75 ], [ 423416.75, 568409.199999999953434 ], [ 423418.349999999976717, 568411.599999999976717 ], [ 423419.450000000011642, 568413.099999999976717 ], [ 423420.450000000011642, 568414.550000000046566 ], [ 423421.0, 568415.550000000046566 ], [ 423421.5, 568416.5 ], [ 423424.5, 568422.949999999953434 ], [ 423425.650000000023283, 568425.099999999976717 ], [ 423426.650000000023283, 568427.25 ], [ 423427.650000000023283, 568429.5 ], [ 423428.450000000011642, 568431.800000000046566 ], [ 423428.950000000011642, 568433.25 ], [ 423429.349999999976717, 568434.75 ], [ 423429.549999999988358, 568435.949999999953434 ], [ 423429.650000000023283, 568437.099999999976717 ], [ 423429.650000000023283, 568437.349999999976717 ], [ 423429.549999999988358, 568438.5 ], [ 423429.299999999988358, 568439.599999999976717 ], [ 423429.200000000011642, 568439.900000000023283 ], [ 423428.900000000023283, 568440.75 ], [ 423428.5, 568441.599999999976717 ], [ 423428.049999999988358, 568442.449999999953434 ], [ 423427.5, 568443.25 ], [ 423426.599999999976717, 568444.150000000023283 ], [ 423425.799999999988358, 568444.800000000046566 ], [ 423423.299999999988358, 568446.199999999953434 ], [ 423422.200000000011642, 568446.800000000046566 ], [ 423421.150000000023283, 568447.349999999976717 ], [ 423413.650000000023283, 568451.349999999976717 ], [ 423409.5, 568453.400000000023283 ], [ 423411.058000000019092, 568456.37300000002142 ], [ 423415.57, 568454.020000000018626 ], [ 423421.349999999976717, 568451.0 ], [ 423427.75, 568447.800000000046566 ], [ 423428.599999999976717, 568447.25 ], [ 423428.663999999989755, 568447.202000000048429 ], [ 423441.079000000027008, 568441.152 ], [ 423457.935, 568432.937999999965541 ], [ 423458.5, 568432.699999999953434 ], [ 423459.700000000011642, 568432.099999999976717 ], [ 423462.25, 568430.75 ], [ 423483.299999999988358, 568420.449999999953434 ], [ 423497.51, 568413.349999999976717 ], [ 423500.0, 568412.099999999976717 ], [ 423502.32, 568410.930000000051223 ], [ 423508.099999999976717, 568408.020000000018626 ], [ 423514.424999999988358, 568404.839000000036322 ], [ 423512.770000000018626, 568401.37 ], [ 423504.31, 568405.63 ], [ 423500.0, 568407.800000000046566 ], [ 423496.62, 568409.49 ], [ 423488.549999999988358, 568413.540000000037253 ], [ 423480.25, 568417.699999999953434 ], [ 423471.650000000023283, 568421.949999999953434 ], [ 423449.299999999988358, 568430.199999999953434 ], [ 423448.950000000011642, 568430.099999999976717 ], [ 423448.150000000023283, 568429.900000000023283 ], [ 423447.299999999988358, 568429.599999999976717 ], [ 423446.400000000023283, 568429.099999999976717 ], [ 423445.5, 568428.5 ], [ 423444.75, 568427.900000000023283 ], [ 423444.099999999976717, 568427.150000000023283 ], [ 423443.5, 568426.400000000023283 ], [ 423442.950000000011642, 568425.599999999976717 ], [ 423442.549999999988358, 568424.900000000023283 ], [ 423442.099999999976717, 568424.150000000023283 ], [ 423437.830000000016298, 568415.650000000023283 ], [ 423434.479999999981374, 568408.800000000046566 ], [ 423434.099999999976717, 568408.25 ], [ 423432.650000000023283, 568405.300000000046566 ], [ 423431.099999999976717, 568402.550000000046566 ], [ 423430.60999999998603, 568401.790000000037253 ], [ 423428.0, 568398.050000000046566 ], [ 423425.200000000011642, 568394.599999999976717 ], [ 423422.450000000011642, 568391.199999999953434 ], [ 423419.599999999976717, 568387.949999999953434 ], [ 423419.46999999997206, 568387.770000000018626 ], [ 423413.099999999976717, 568381.650000000023283 ], [ 423409.799999999988358, 568378.650000000023283 ], [ 423406.539999999979045, 568375.78000000002794 ], [ 423403.200000000011642, 568373.050000000046566 ], [ 423400.01, 568370.660000000032596 ], [ 423399.799999999988358, 568370.5 ], [ 423396.099999999976717, 568367.949999999953434 ], [ 423392.25, 568365.550000000046566 ], [ 423390.049999999988358, 568364.25 ], [ 423387.849999999976717, 568363.0 ], [ 423385.200000000011642, 568361.57999999995809 ], [ 423374.909999999974389, 568348.979999999981374 ], [ 423373.32, 568341.62 ], [ 423371.799999999988358, 568334.599999999976717 ], [ 423370.28000000002794, 568327.560000000055879 ], [ 423368.69, 568320.189999999944121 ], [ 423367.200000000011642, 568313.300000000046566 ] ] ] } }, +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1f20", "INSPIREID": 25791501, "LABEL": 25791501, "NATIONALCADASTRALREFERENCE": 25791501, "VALIDFROM": "2009-02-09T00:00:00Z", "BEGINLIFESPANVERSION": "2015-06-13T10:15:58.464Z" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423557.31, 568331.0 ], [ 423582.697448503167834, 568338.083047115243971 ], [ 423593.994488024211023, 568361.062252504634671 ], [ 423570.150000000023283, 568372.800000000046566 ], [ 423562.06, 568376.810000000055879 ], [ 423553.64000000001397, 568380.979999999981374 ], [ 423545.409999999974389, 568385.069999999948777 ], [ 423537.37, 568389.050000000046566 ], [ 423529.200000000011642, 568393.099999999976717 ], [ 423520.950000000011642, 568397.25 ], [ 423512.770000000018626, 568401.37 ], [ 423514.424999999988358, 568404.839000000036322 ], [ 423583.299999999988358, 568370.199999999953434 ], [ 423584.75, 568369.349999999976717 ], [ 423585.077, 568369.11199999996461 ], [ 423585.321999999985565, 568368.920999999972992 ], [ 423594.48599999997532, 568363.851000000024214 ], [ 423603.359, 568358.942000000039116 ], [ 423605.863000000012107, 568356.606999999959953 ], [ 423609.112000000022817, 568353.577999999979511 ], [ 423613.700000000011642, 568349.300000000046566 ], [ 423612.650000000023283, 568349.449999999953434 ], [ 423611.0, 568349.449999999953434 ], [ 423609.349999999976717, 568349.349999999976717 ], [ 423608.75, 568349.300000000046566 ], [ 423607.150000000023283, 568349.0 ], [ 423605.549999999988358, 568348.550000000046566 ], [ 423604.849999999976717, 568348.25 ], [ 423603.450000000011642, 568347.599999999976717 ], [ 423602.099999999976717, 568346.849999999976717 ], [ 423601.450000000011642, 568346.400000000023283 ], [ 423600.150000000023283, 568345.349999999976717 ], [ 423598.950000000011642, 568344.199999999953434 ], [ 423595.900000000023283, 568331.400000000023283 ], [ 423587.799999999988358, 568329.300000000046566 ], [ 423579.75, 568327.270000000018626 ], [ 423570.729999999981374, 568325.0 ], [ 423561.840000000025611, 568322.76 ], [ 423553.12, 568320.560000000055879 ], [ 423543.950000000011642, 568318.25 ], [ 423535.28000000002794, 568316.07999999995809 ], [ 423526.25, 568313.819999999948777 ], [ 423517.63, 568311.660000000032596 ], [ 423508.599999999976717, 568309.400000000023283 ], [ 423499.549999999988358, 568307.099999999976717 ], [ 423490.950000000011642, 568304.849999999976717 ], [ 423482.200000000011642, 568302.5 ], [ 423467.700000000011642, 568298.800000000046566 ], [ 423459.799999999988358, 568296.900000000023283 ], [ 423452.549999999988358, 568295.050000000046566 ], [ 423444.900000000023283, 568293.099999999976717 ], [ 423438.099999999976717, 568291.400000000023283 ], [ 423437.729, 568293.278999999980442 ], [ 423437.188000000023749, 568296.015999999945052 ], [ 423440.400000000023283, 568296.849999999976717 ], [ 423441.099999999976717, 568297.0 ], [ 423485.299999999988358, 568307.849999999976717 ], [ 423500.0, 568311.650000000023283 ], [ 423502.150000000023283, 568312.5 ], [ 423507.653999999980442, 568313.84499999997206 ], [ 423523.715000000025611, 568317.770000000018626 ], [ 423523.085000000020955, 568320.214999999967404 ], [ 423522.539999999979045, 568322.32999999995809 ], [ 423531.25, 568324.449999999953434 ], [ 423540.159999999974389, 568326.689999999944121 ], [ 423549.19, 568328.959999999962747 ], [ 423557.31, 568331.0 ] ] ] } } +] +} diff --git a/test_cases/test_case_5_bounding_box.geojson b/test_cases/test_case_5_bounding_box.geojson new file mode 100644 index 0000000..8e50948 --- /dev/null +++ b/test_cases/test_case_5_bounding_box.geojson @@ -0,0 +1,8 @@ +{ +"type": "FeatureCollection", +"name": "test_case_5_bounding_box", +"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::27700" } }, +"features": [ +{ "type": "Feature", "properties": { "gml_id": "PREDEFINED.fid-3add56ff_191ab93c9d1_-1de7", "INSPIREID": 25826568, "LABEL": 25826568, "NATIONALCADASTRALREFERENCE": 25826568, "VALIDFROM": "2009-01-19T11:45:10.944Z", "BEGINLIFESPANVERSION": "2009-01-19T11:45:10.944Z", "width": 65.883, "height": 77.479, "area": 5104.548957, "perimeter": 286.724 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 423936.799999999988358, 567998.721000000019558 ], [ 424002.683000000019092, 567998.721000000019558 ], [ 424002.683000000019092, 568076.199999999953434 ], [ 423936.799999999988358, 568076.199999999953434 ], [ 423936.799999999988358, 567998.721000000019558 ] ] ] } } +] +} diff --git a/test_cases/test_cases.md b/test_cases/test_cases.md new file mode 100644 index 0000000..a526ccd --- /dev/null +++ b/test_cases/test_cases.md @@ -0,0 +1,133 @@ +This document gives a high-level overview of the test cases which are used to explore the potential for the road space classification using Inspire polygons. + +# About the Test Data + +The test data includes data derived from the [Land Registry INSPIRE polygons](https://use-land-property-data.service.gov.uk/datasets/inspire). This data is used under [Open Government Licence (OGL)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) and include these attributions: + +* This information is subject to Crown copyright and database rights [2024] and is reproduced with the permission of HM Land Registry. +* The polygons (including the associated geometry, namely x, y co-ordinates) are subject to Crown copyright and database rights [2024] Ordnance Survey AC0000851063. + +--- +Additionally: Any boundaries between road space and non-road space are approximate. They have been drawn by hand, based on the visual appearance of the map purely for use in this test data, and in no way represent the actual legal boundaries. + + +# Grouping + +## Cases A only involving whole positive INSPIRE polygons + +* Case1 +* Case3 +* Case5 + +## Cases B which require sub-dividing negative space between INSPIRE polygons + +* Case 2 + +## Cases C involving sub-dividing positive INSPIRE polygons + +* Case4 + + +# Individual Cases + +## Case 1 + +Great North Road, Newcastle Upon Tyne + +There is a section which is dual carriageway, with a central reservation. +The northbound carriageway (west side) is mostly on unregistered land, +but the southbound carriageway (east side) is on a series of long, thin parcels of land. + +These are the parcels should be classified as road space: + +``` +inspire_id in ( + 25855822, + 25852274, + 25853082, + 25857333, + 25853200, + 25853129, + 25853929, +) +``` + +Typical description of the parcels, from the Land Registry: + +""" +Summary of freehold +Property description = "Land forming part of Great North Road, Gosforth, Newcastle Upon Tyne" +""" + +### Success: + +These parcels are correctly identified as road space. The neighbouring parcels are correctly identified at non-road space. + +## Case 2 + +There are residential properties which are not registered on the Land Registry, which front a road which is also on unregistered land. +The approximate location of the boundary is intuitively visible on the map. + +### Success: + +The polygons in `test_case_2_expected_non_road_space.geojson` are correctly identified as non-road space. +The overlap between the identified road space and the "missing-polygons" is a small value (metric TBD). + +Possible metric would be: +intersection(expected, actual) / union(expected, actual) +https://en.wikipedia.org/wiki/Jaccard_index + +## Case 3 + +Another example of a long thin parcel of land, which is road space. + +### Success: + +The following parcels should be classified as road space: +25809009 + +The following parcels should be classified as non-road space: +25803085 +25803248 +54395749 + +(there are other parcels within this bounding box they are not relevant for this test) + + +## Case 4 + +Pathalogical case: INSPIREID 25791501 and 25782300 + +This is a mixture of road space and non-road space. + +* The non-road space is (in appearance) like an unregistered private property. +* The "road space" part of the polygon is the width of the road for part of the length, but then only occupies a half the width of the road for at the western end. The western end shares the width of the road with 25782300 (which is another pathological case). +* There is an broad junction at the east end, which is close to a private property. + +### Possible strategies: + +Treat the whole polygon like Case #2. Then sub divide the polygon into road space and non-road space. + +### Success: + +The missing polygons are correctly identified as non-road space. +The overlap between the identified road space and the "missing-polygons" is a small value (metric TBD). + +* The polygons in `test_case_4_expected_road_space.geojson` are correctly identified as road space. +* The polygons in `test_case_4_expected_non_road_space.geojson` are correctly identified as non-road space. + +In both cases, we need to decide if this metric is applied to each polygon individually, or to all the polygons in aggregate. + +## Case 5: + +Fragment of land which has been incorporated into a junction. + +INSPIREID = 25826568 + +This should be classified as road space. + +Most other parcels in the bounding box are classified as non-road space. + +### Success: + +The parcel is correctly identified as road space. The neighbouring parcels are correctly identified at non-road space.