From 999a7d58cc1cbd718793b5edd2cbfe686d59a399 Mon Sep 17 00:00:00 2001 From: Jacob Bates Date: Fri, 26 Apr 2024 13:53:14 -0500 Subject: [PATCH 1/5] add bc_lines with test --- src/rashdf/geom.py | 39 +++++++++++++++++++++++++++++++++-- tests/data/json/bc_lines.json | 1 + tests/test_geom.py | 8 ++++++- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 tests/data/json/bc_lines.json diff --git a/src/rashdf/geom.py b/src/rashdf/geom.py index 5209655..58171b5 100644 --- a/src/rashdf/geom.py +++ b/src/rashdf/geom.py @@ -5,7 +5,7 @@ import pandas as pd from geopandas import GeoDataFrame from pyproj import CRS -from shapely import Polygon, Point, LineString, polygonize +from shapely import Polygon, Point, LineString, MultiLineString, polygonize from typing import Optional @@ -142,7 +142,42 @@ def mesh_cell_faces(self) -> GeoDataFrame: return GeoDataFrame(face_dict, geometry="geometry", crs=self.projection()) def bc_lines(self) -> GeoDataFrame: - raise NotImplementedError + """Return the 2D mesh area boundary condition lines. + + Returns + ------- + GeoDataFrame + A GeoDataFrame containing the 2D mesh area boundary condition lines if they exist. + """ + if "/Geometry/Boundary Condition Lines" not in self: + return GeoDataFrame() + bc_line_data = self["/Geometry/Boundary Condition Lines"] + bc_line_ids = range(bc_line_data["Attributes"][()].shape[0]) + v_conv_str = np.vectorize(convert_ras_hdf_string) + names = v_conv_str(bc_line_data["Attributes"][()]["Name"]) + mesh_names = v_conv_str(bc_line_data["Attributes"][()]["SA-2D"]) + types = v_conv_str(bc_line_data["Attributes"][()]["Type"]) + multi_lines = list() + for i, polyline_info in enumerate(bc_line_data["Polyline Info"][()]): + pnt_start, pnt_cnt, part_start, part_cnt = polyline_info + points = bc_line_data["Polyline Points"][()][pnt_start:pnt_start+pnt_cnt] + parts = bc_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] + multi_lines.append( + MultiLineString( + list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + ) + ) + return GeoDataFrame( + { + "bc_line_id":bc_line_ids, + "name":names, + "mesh_name":mesh_names, + "type":types, + "geometry":multi_lines + }, + geometry="geometry", + crs=self.projection() + ) def breaklines(self) -> GeoDataFrame: raise NotImplementedError diff --git a/tests/data/json/bc_lines.json b/tests/data/json/bc_lines.json new file mode 100644 index 0000000..aa15afe --- /dev/null +++ b/tests/data/json/bc_lines.json @@ -0,0 +1 @@ +{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"bc_line_id": 0, "name": "2d_out", "mesh_name": "2D Interior Area", "type": "External"}, "geometry": {"type": "MultiLineString", "coordinates": [[[406023.42, 1801556.29], [406029.95, 1801947.71]]]}}, {"id": "1", "type": "Feature", "properties": {"bc_line_id": 1, "name": "NW_out", "mesh_name": "Perimeter_NW", "type": "External"}, "geometry": {"type": "MultiLineString", "coordinates": [[[403925.27, 1802019.54], [403620.03, 1802568.0]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file diff --git a/tests/test_geom.py b/tests/test_geom.py index 13342b2..f573ada 100644 --- a/tests/test_geom.py +++ b/tests/test_geom.py @@ -43,4 +43,10 @@ def test_mesh_cell_polygons(): geom = TEST_DATA / "ras/Muncie.g05.hdf" with RasGeomHdf(geom) as ghdf: with open(TEST_DATA / "json/mesh_cell_polygons.json") as json: - assert ghdf.mesh_cell_polygons().to_json() == json.read() \ No newline at end of file + assert ghdf.mesh_cell_polygons().to_json() == json.read() + +def test_bc_lines(): + geom = TEST_DATA / "ras/Muncie.g05.hdf" + with RasGeomHdf(geom) as ghdf: + with open(TEST_DATA / "json/bc_lines.json") as json: + assert ghdf.bc_lines().to_json() == json.read() \ No newline at end of file From 47dd94c2133bca31ea14ddc8d6cc2600a59595bc Mon Sep 17 00:00:00 2001 From: Jacob Bates Date: Fri, 26 Apr 2024 14:30:12 -0500 Subject: [PATCH 2/5] add breaklines with test --- src/rashdf/geom.py | 32 +++++++++++++++++++++++++++++++- tests/data/json/breaklines.json | 1 + tests/test_geom.py | 8 +++++++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 tests/data/json/breaklines.json diff --git a/src/rashdf/geom.py b/src/rashdf/geom.py index 58171b5..69267ff 100644 --- a/src/rashdf/geom.py +++ b/src/rashdf/geom.py @@ -180,7 +180,37 @@ def bc_lines(self) -> GeoDataFrame: ) def breaklines(self) -> GeoDataFrame: - raise NotImplementedError + """Return the 2D mesh area breaklines. + + Returns + ------- + GeoDataFrame + A GeoDataFrame containing the 2D mesh area breaklines if they exist. + """ + if "/Geometry/2D Flow Area Break Lines" not in self: + return GeoDataFrame() + bl_line_data = self["/Geometry/2D Flow Area Break Lines"] + bl_line_ids = range(bl_line_data["Attributes"][()].shape[0]) + names = np.vectorize(convert_ras_hdf_string)(bl_line_data["Attributes"][()]["Name"]) + multi_lines = list() + for i, polyline_info in enumerate(bl_line_data["Polyline Info"][()]): + pnt_start, pnt_cnt, part_start, part_cnt = polyline_info + points = bl_line_data["Polyline Points"][()][pnt_start:pnt_start+pnt_cnt] + parts = bl_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] + multi_lines.append( + MultiLineString( + list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + ) + ) + return GeoDataFrame( + { + "bl_id":bl_line_ids, + "name":names, + "geometry":multi_lines + }, + geometry="geometry", + crs=self.projection() + ) def refinement_regions(self) -> GeoDataFrame: raise NotImplementedError diff --git a/tests/data/json/breaklines.json b/tests/data/json/breaklines.json new file mode 100644 index 0000000..72bd742 --- /dev/null +++ b/tests/data/json/breaklines.json @@ -0,0 +1 @@ +{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"bl_id": 0, "name": "Road 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[409074.78, 1802876.36], [409026.14, 1802817.66], [408942.28, 1802769.02], [408870.17, 1802745.54], [408828.24, 1802740.51], [408806.44, 1802720.39], [408774.57, 1802686.84], [408719.22, 1802626.47], [408695.74, 1802596.28], [408695.74, 1802564.41], [408727.61, 1802530.87], [408781.28, 1802463.78], [408819.85, 1802436.95], [408943.96, 1802418.5], [409019.43, 1802416.82], [409051.3, 1802396.7], [409026.14, 1802322.9], [409006.02, 1802249.11], [409019.43, 1802116.61], [409007.69, 1802026.05], [409002.66, 1801870.07]]]}}, {"id": "1", "type": "Feature", "properties": {"bl_id": 1, "name": "HighGround 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[410305.8, 1801586.64], [410290.71, 1801675.53], [410240.39, 1801740.93], [410134.73, 1801789.57], [410015.65, 1801878.46], [409901.61, 1801963.99], [409871.42, 1802052.88], [409849.62, 1802158.54], [409837.88, 1802265.88], [409804.33, 1802336.32], [409737.25, 1802374.89], [409650.04, 1802391.67], [409594.69, 1802405.08], [409537.67, 1802405.08], [409484.0, 1802395.02], [409430.33, 1802401.73], [409374.99, 1802423.53], [409334.74, 1802426.89], [409271.0, 1802416.82], [409232.43, 1802406.76], [409123.42, 1802410.11], [409063.04, 1802410.11]]]}}, {"id": "2", "type": "Feature", "properties": {"bl_id": 2, "name": "Breakline 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[410388.19, 1802731.41], [410547.77, 1802837.8], [410735.99, 1802907.36], [410891.48, 1802911.45], [411267.92, 1802874.62]]]}}, {"id": "3", "type": "Feature", "properties": {"bl_id": 3, "name": "Breakline 2"}, "geometry": {"type": "MultiLineString", "coordinates": [[[402838.91, 1804637.9], [402791.97, 1804500.22], [402879.58, 1804431.38], [402820.13, 1804362.54], [402557.28, 1804346.89], [402375.79, 1804315.6], [402350.76, 1804231.11], [402375.79, 1804059.01], [402463.41, 1804002.69], [402641.77, 1803987.04], [402782.58, 1804005.82], [402798.23, 1803918.2]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file diff --git a/tests/test_geom.py b/tests/test_geom.py index f573ada..423a689 100644 --- a/tests/test_geom.py +++ b/tests/test_geom.py @@ -49,4 +49,10 @@ def test_bc_lines(): geom = TEST_DATA / "ras/Muncie.g05.hdf" with RasGeomHdf(geom) as ghdf: with open(TEST_DATA / "json/bc_lines.json") as json: - assert ghdf.bc_lines().to_json() == json.read() \ No newline at end of file + assert ghdf.bc_lines().to_json() == json.read() + +def test_breaklines(): + geom = TEST_DATA / "ras/Muncie.g05.hdf" + with RasGeomHdf(geom) as ghdf: + with open(TEST_DATA / "json/breaklines.json") as json: + assert ghdf.breaklines().to_json() == json.read() \ No newline at end of file From f65410bdfcc5ec6131cafe7cbf133d19c7d69b3a Mon Sep 17 00:00:00 2001 From: Jacob Bates Date: Fri, 26 Apr 2024 16:22:41 -0500 Subject: [PATCH 3/5] add refinement_regions with test --- src/rashdf/geom.py | 34 +++++++++++++++++++++++-- tests/data/json/refinement_regions.json | 1 + tests/test_geom.py | 8 +++++- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 tests/data/json/refinement_regions.json diff --git a/src/rashdf/geom.py b/src/rashdf/geom.py index 69267ff..0b19d4e 100644 --- a/src/rashdf/geom.py +++ b/src/rashdf/geom.py @@ -5,7 +5,7 @@ import pandas as pd from geopandas import GeoDataFrame from pyproj import CRS -from shapely import Polygon, Point, LineString, MultiLineString, polygonize +from shapely import Polygon, Point, LineString, MultiLineString, MultiPolygon, polygonize from typing import Optional @@ -213,7 +213,37 @@ def breaklines(self) -> GeoDataFrame: ) def refinement_regions(self) -> GeoDataFrame: - raise NotImplementedError + """Return the 2D mesh area refinement regions. + + Returns + ------- + GeoDataFrame + A GeoDataFrame containing the 2D mesh area refinement regions if they exist. + """ + if "/Geometry/2D Flow Area Refinement Regions" not in self: + return GeoDataFrame() + rr_data = self["/Geometry/2D Flow Area Refinement Regions"] + rr_ids = range(rr_data["Attributes"][()].shape[0]) + names = np.vectorize(convert_ras_hdf_string)(rr_data["Attributes"][()]["Name"]) + multi_polygons = list() + for i, polygon_info in enumerate(rr_data["Polygon Info"][()]): + pnt_start, pnt_cnt, part_start, part_cnt = polygon_info + points = rr_data["Polygon Points"][()][pnt_start:pnt_start+pnt_cnt] + parts = rr_data["Polygon Parts"][()][part_start:part_start+part_cnt] + multi_polygons.append( + MultiLineString( + list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + ) + ) + return GeoDataFrame( + { + "rr_id":rr_ids, + "name":names, + "geometry":multi_polygons + }, + geometry="geometry", + crs=self.projection() + ) def connections(self) -> GeoDataFrame: raise NotImplementedError diff --git a/tests/data/json/refinement_regions.json b/tests/data/json/refinement_regions.json new file mode 100644 index 0000000..5aabf5a --- /dev/null +++ b/tests/data/json/refinement_regions.json @@ -0,0 +1 @@ +{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"rr_id": 0, "name": "Region 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[403466.64123541984, 1804195.9021819197], [403449.7976758183, 1804409.253936872], [403607.00423209905, 1804515.9298143482], [403865.27214598877, 1804549.6169335512], [403955.1044638635, 1804392.4103772705], [403932.6463843948, 1804201.5167017868], [403792.2833877156, 1804083.6117845762], [403646.3058711692, 1804061.1537051075], [403539.62999369303, 1804094.8408243107], [403466.64123541984, 1804195.9021819197]]]}}, {"id": "1", "type": "Feature", "properties": {"rr_id": 1, "name": "Region 2"}, "geometry": {"type": "MultiLineString", "coordinates": [[[408105.7632410168, 1803317.9615429805], [408201.9074582713, 1803374.3219461986], [408404.14184628957, 1803251.6551862531], [408397.51121061685, 1803065.9973874167], [408500.2860635441, 1802926.7540382894], [408599.74559863505, 1802837.2404567075], [408719.09704074415, 1802777.564735653], [408735.673629926, 1802731.1502859439], [408652.7906840169, 1802648.267340035], [408503.6013813805, 1802628.3754330166], [408288.10572201683, 1802717.8890145984], [408155.49300856225, 1802850.501728053], [408049.4028377986, 1802946.6459453076], [407979.7811632349, 1803029.5288912167], [407963.2045740531, 1803158.826286835], [408022.88029510767, 1803251.6551862531], [408105.7632410168, 1803317.9615429805]]]}}, {"id": "2", "type": "Feature", "properties": {"rr_id": 2, "name": "Region 3"}, "geometry": {"type": "MultiLineString", "coordinates": [[[410254.0891989809, 1802329.9968277444], [410366.81000541727, 1802356.5193704353], [410615.4588431446, 1802366.4653239443], [410761.3328279446, 1802313.4202385624], [410874.053634381, 1802220.5913391444], [410814.37791332643, 1802071.4020365078], [410648.6120215082, 1802005.0956797807], [410532.5758972355, 1802011.7263154534], [410356.86405190814, 1802078.0326721806], [410277.2964238354, 1802187.4381607806], [410254.0891989809, 1802329.9968277444]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file diff --git a/tests/test_geom.py b/tests/test_geom.py index 423a689..964095e 100644 --- a/tests/test_geom.py +++ b/tests/test_geom.py @@ -55,4 +55,10 @@ def test_breaklines(): geom = TEST_DATA / "ras/Muncie.g05.hdf" with RasGeomHdf(geom) as ghdf: with open(TEST_DATA / "json/breaklines.json") as json: - assert ghdf.breaklines().to_json() == json.read() \ No newline at end of file + assert ghdf.breaklines().to_json() == json.read() + +def test_refinement_regions(): + geom = TEST_DATA / "ras/Muncie.g05.hdf" + with RasGeomHdf(geom) as ghdf: + with open(TEST_DATA / "json/refinement_regions.json") as json: + assert ghdf.refinement_regions().to_json() == json.read() \ No newline at end of file From 7ee254aa96c337915bb30cb2afb9f6e1354ca66b Mon Sep 17 00:00:00 2001 From: Jacob Bates Date: Fri, 26 Apr 2024 16:25:25 -0500 Subject: [PATCH 4/5] remove uneeded enumerate objects --- src/rashdf/geom.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/rashdf/geom.py b/src/rashdf/geom.py index 0b19d4e..4038f3f 100644 --- a/src/rashdf/geom.py +++ b/src/rashdf/geom.py @@ -158,8 +158,7 @@ def bc_lines(self) -> GeoDataFrame: mesh_names = v_conv_str(bc_line_data["Attributes"][()]["SA-2D"]) types = v_conv_str(bc_line_data["Attributes"][()]["Type"]) multi_lines = list() - for i, polyline_info in enumerate(bc_line_data["Polyline Info"][()]): - pnt_start, pnt_cnt, part_start, part_cnt = polyline_info + for pnt_start, pnt_cnt, part_start, part_cnt in bc_line_data["Polyline Info"][()]: points = bc_line_data["Polyline Points"][()][pnt_start:pnt_start+pnt_cnt] parts = bc_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] multi_lines.append( @@ -193,8 +192,7 @@ def breaklines(self) -> GeoDataFrame: bl_line_ids = range(bl_line_data["Attributes"][()].shape[0]) names = np.vectorize(convert_ras_hdf_string)(bl_line_data["Attributes"][()]["Name"]) multi_lines = list() - for i, polyline_info in enumerate(bl_line_data["Polyline Info"][()]): - pnt_start, pnt_cnt, part_start, part_cnt = polyline_info + for pnt_start, pnt_cnt, part_start, part_cnt in bl_line_data["Polyline Info"][()]: points = bl_line_data["Polyline Points"][()][pnt_start:pnt_start+pnt_cnt] parts = bl_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] multi_lines.append( @@ -226,8 +224,7 @@ def refinement_regions(self) -> GeoDataFrame: rr_ids = range(rr_data["Attributes"][()].shape[0]) names = np.vectorize(convert_ras_hdf_string)(rr_data["Attributes"][()]["Name"]) multi_polygons = list() - for i, polygon_info in enumerate(rr_data["Polygon Info"][()]): - pnt_start, pnt_cnt, part_start, part_cnt = polygon_info + for pnt_start, pnt_cnt, part_start, part_cnt in rr_data["Polygon Info"][()]: points = rr_data["Polygon Points"][()][pnt_start:pnt_start+pnt_cnt] parts = rr_data["Polygon Parts"][()][part_start:part_start+part_cnt] multi_polygons.append( From abe9b560c8f06e54a9638bd6cc622535ccac701b Mon Sep 17 00:00:00 2001 From: Jacob Bates Date: Tue, 30 Apr 2024 13:19:11 -0500 Subject: [PATCH 5/5] make geometries singlepart when possible --- src/rashdf/geom.py | 51 +++++++++++++++---------- tests/data/json/bc_lines.json | 2 +- tests/data/json/breaklines.json | 2 +- tests/data/json/refinement_regions.json | 2 +- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/rashdf/geom.py b/src/rashdf/geom.py index 4038f3f..725b6cd 100644 --- a/src/rashdf/geom.py +++ b/src/rashdf/geom.py @@ -157,22 +157,25 @@ def bc_lines(self) -> GeoDataFrame: names = v_conv_str(bc_line_data["Attributes"][()]["Name"]) mesh_names = v_conv_str(bc_line_data["Attributes"][()]["SA-2D"]) types = v_conv_str(bc_line_data["Attributes"][()]["Type"]) - multi_lines = list() + geoms = list() for pnt_start, pnt_cnt, part_start, part_cnt in bc_line_data["Polyline Info"][()]: points = bc_line_data["Polyline Points"][()][pnt_start:pnt_start+pnt_cnt] - parts = bc_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] - multi_lines.append( - MultiLineString( - list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + if part_cnt == 1: + geoms.append(LineString(points)) + else: + parts = bc_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] + geoms.append( + MultiLineString( + list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + ) ) - ) return GeoDataFrame( { "bc_line_id":bc_line_ids, "name":names, "mesh_name":mesh_names, "type":types, - "geometry":multi_lines + "geometry":geoms }, geometry="geometry", crs=self.projection() @@ -191,20 +194,23 @@ def breaklines(self) -> GeoDataFrame: bl_line_data = self["/Geometry/2D Flow Area Break Lines"] bl_line_ids = range(bl_line_data["Attributes"][()].shape[0]) names = np.vectorize(convert_ras_hdf_string)(bl_line_data["Attributes"][()]["Name"]) - multi_lines = list() + geoms = list() for pnt_start, pnt_cnt, part_start, part_cnt in bl_line_data["Polyline Info"][()]: points = bl_line_data["Polyline Points"][()][pnt_start:pnt_start+pnt_cnt] - parts = bl_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] - multi_lines.append( - MultiLineString( - list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + if part_cnt == 1: + geoms.append(LineString(points)) + else: + parts = bl_line_data["Polyline Parts"][()][part_start:part_start+part_cnt] + geoms.append( + MultiLineString( + list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + ) ) - ) return GeoDataFrame( { "bl_id":bl_line_ids, "name":names, - "geometry":multi_lines + "geometry":geoms }, geometry="geometry", crs=self.projection() @@ -223,20 +229,23 @@ def refinement_regions(self) -> GeoDataFrame: rr_data = self["/Geometry/2D Flow Area Refinement Regions"] rr_ids = range(rr_data["Attributes"][()].shape[0]) names = np.vectorize(convert_ras_hdf_string)(rr_data["Attributes"][()]["Name"]) - multi_polygons = list() + geoms = list() for pnt_start, pnt_cnt, part_start, part_cnt in rr_data["Polygon Info"][()]: points = rr_data["Polygon Points"][()][pnt_start:pnt_start+pnt_cnt] - parts = rr_data["Polygon Parts"][()][part_start:part_start+part_cnt] - multi_polygons.append( - MultiLineString( - list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + if part_cnt == 1: + geoms.append(Polygon(points)) + else: + parts = rr_data["Polygon Parts"][()][part_start:part_start+part_cnt] + geoms.append( + MultiPolygon( + list(points[part_pnt_start:part_pnt_start+part_pnt_cnt] for part_pnt_start, part_pnt_cnt in parts) + ) ) - ) return GeoDataFrame( { "rr_id":rr_ids, "name":names, - "geometry":multi_polygons + "geometry":geoms }, geometry="geometry", crs=self.projection() diff --git a/tests/data/json/bc_lines.json b/tests/data/json/bc_lines.json index aa15afe..9bc1388 100644 --- a/tests/data/json/bc_lines.json +++ b/tests/data/json/bc_lines.json @@ -1 +1 @@ -{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"bc_line_id": 0, "name": "2d_out", "mesh_name": "2D Interior Area", "type": "External"}, "geometry": {"type": "MultiLineString", "coordinates": [[[406023.42, 1801556.29], [406029.95, 1801947.71]]]}}, {"id": "1", "type": "Feature", "properties": {"bc_line_id": 1, "name": "NW_out", "mesh_name": "Perimeter_NW", "type": "External"}, "geometry": {"type": "MultiLineString", "coordinates": [[[403925.27, 1802019.54], [403620.03, 1802568.0]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file +{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"bc_line_id": 0, "name": "2d_out", "mesh_name": "2D Interior Area", "type": "External"}, "geometry": {"type": "LineString", "coordinates": [[406023.42, 1801556.29], [406029.95, 1801947.71]]}}, {"id": "1", "type": "Feature", "properties": {"bc_line_id": 1, "name": "NW_out", "mesh_name": "Perimeter_NW", "type": "External"}, "geometry": {"type": "LineString", "coordinates": [[403925.27, 1802019.54], [403620.03, 1802568.0]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file diff --git a/tests/data/json/breaklines.json b/tests/data/json/breaklines.json index 72bd742..31c718c 100644 --- a/tests/data/json/breaklines.json +++ b/tests/data/json/breaklines.json @@ -1 +1 @@ -{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"bl_id": 0, "name": "Road 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[409074.78, 1802876.36], [409026.14, 1802817.66], [408942.28, 1802769.02], [408870.17, 1802745.54], [408828.24, 1802740.51], [408806.44, 1802720.39], [408774.57, 1802686.84], [408719.22, 1802626.47], [408695.74, 1802596.28], [408695.74, 1802564.41], [408727.61, 1802530.87], [408781.28, 1802463.78], [408819.85, 1802436.95], [408943.96, 1802418.5], [409019.43, 1802416.82], [409051.3, 1802396.7], [409026.14, 1802322.9], [409006.02, 1802249.11], [409019.43, 1802116.61], [409007.69, 1802026.05], [409002.66, 1801870.07]]]}}, {"id": "1", "type": "Feature", "properties": {"bl_id": 1, "name": "HighGround 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[410305.8, 1801586.64], [410290.71, 1801675.53], [410240.39, 1801740.93], [410134.73, 1801789.57], [410015.65, 1801878.46], [409901.61, 1801963.99], [409871.42, 1802052.88], [409849.62, 1802158.54], [409837.88, 1802265.88], [409804.33, 1802336.32], [409737.25, 1802374.89], [409650.04, 1802391.67], [409594.69, 1802405.08], [409537.67, 1802405.08], [409484.0, 1802395.02], [409430.33, 1802401.73], [409374.99, 1802423.53], [409334.74, 1802426.89], [409271.0, 1802416.82], [409232.43, 1802406.76], [409123.42, 1802410.11], [409063.04, 1802410.11]]]}}, {"id": "2", "type": "Feature", "properties": {"bl_id": 2, "name": "Breakline 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[410388.19, 1802731.41], [410547.77, 1802837.8], [410735.99, 1802907.36], [410891.48, 1802911.45], [411267.92, 1802874.62]]]}}, {"id": "3", "type": "Feature", "properties": {"bl_id": 3, "name": "Breakline 2"}, "geometry": {"type": "MultiLineString", "coordinates": [[[402838.91, 1804637.9], [402791.97, 1804500.22], [402879.58, 1804431.38], [402820.13, 1804362.54], [402557.28, 1804346.89], [402375.79, 1804315.6], [402350.76, 1804231.11], [402375.79, 1804059.01], [402463.41, 1804002.69], [402641.77, 1803987.04], [402782.58, 1804005.82], [402798.23, 1803918.2]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file +{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"bl_id": 0, "name": "Road 1"}, "geometry": {"type": "LineString", "coordinates": [[409074.78, 1802876.36], [409026.14, 1802817.66], [408942.28, 1802769.02], [408870.17, 1802745.54], [408828.24, 1802740.51], [408806.44, 1802720.39], [408774.57, 1802686.84], [408719.22, 1802626.47], [408695.74, 1802596.28], [408695.74, 1802564.41], [408727.61, 1802530.87], [408781.28, 1802463.78], [408819.85, 1802436.95], [408943.96, 1802418.5], [409019.43, 1802416.82], [409051.3, 1802396.7], [409026.14, 1802322.9], [409006.02, 1802249.11], [409019.43, 1802116.61], [409007.69, 1802026.05], [409002.66, 1801870.07]]}}, {"id": "1", "type": "Feature", "properties": {"bl_id": 1, "name": "HighGround 1"}, "geometry": {"type": "LineString", "coordinates": [[410305.8, 1801586.64], [410290.71, 1801675.53], [410240.39, 1801740.93], [410134.73, 1801789.57], [410015.65, 1801878.46], [409901.61, 1801963.99], [409871.42, 1802052.88], [409849.62, 1802158.54], [409837.88, 1802265.88], [409804.33, 1802336.32], [409737.25, 1802374.89], [409650.04, 1802391.67], [409594.69, 1802405.08], [409537.67, 1802405.08], [409484.0, 1802395.02], [409430.33, 1802401.73], [409374.99, 1802423.53], [409334.74, 1802426.89], [409271.0, 1802416.82], [409232.43, 1802406.76], [409123.42, 1802410.11], [409063.04, 1802410.11]]}}, {"id": "2", "type": "Feature", "properties": {"bl_id": 2, "name": "Breakline 1"}, "geometry": {"type": "LineString", "coordinates": [[410388.19, 1802731.41], [410547.77, 1802837.8], [410735.99, 1802907.36], [410891.48, 1802911.45], [411267.92, 1802874.62]]}}, {"id": "3", "type": "Feature", "properties": {"bl_id": 3, "name": "Breakline 2"}, "geometry": {"type": "LineString", "coordinates": [[402838.91, 1804637.9], [402791.97, 1804500.22], [402879.58, 1804431.38], [402820.13, 1804362.54], [402557.28, 1804346.89], [402375.79, 1804315.6], [402350.76, 1804231.11], [402375.79, 1804059.01], [402463.41, 1804002.69], [402641.77, 1803987.04], [402782.58, 1804005.82], [402798.23, 1803918.2]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file diff --git a/tests/data/json/refinement_regions.json b/tests/data/json/refinement_regions.json index 5aabf5a..b91337f 100644 --- a/tests/data/json/refinement_regions.json +++ b/tests/data/json/refinement_regions.json @@ -1 +1 @@ -{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"rr_id": 0, "name": "Region 1"}, "geometry": {"type": "MultiLineString", "coordinates": [[[403466.64123541984, 1804195.9021819197], [403449.7976758183, 1804409.253936872], [403607.00423209905, 1804515.9298143482], [403865.27214598877, 1804549.6169335512], [403955.1044638635, 1804392.4103772705], [403932.6463843948, 1804201.5167017868], [403792.2833877156, 1804083.6117845762], [403646.3058711692, 1804061.1537051075], [403539.62999369303, 1804094.8408243107], [403466.64123541984, 1804195.9021819197]]]}}, {"id": "1", "type": "Feature", "properties": {"rr_id": 1, "name": "Region 2"}, "geometry": {"type": "MultiLineString", "coordinates": [[[408105.7632410168, 1803317.9615429805], [408201.9074582713, 1803374.3219461986], [408404.14184628957, 1803251.6551862531], [408397.51121061685, 1803065.9973874167], [408500.2860635441, 1802926.7540382894], [408599.74559863505, 1802837.2404567075], [408719.09704074415, 1802777.564735653], [408735.673629926, 1802731.1502859439], [408652.7906840169, 1802648.267340035], [408503.6013813805, 1802628.3754330166], [408288.10572201683, 1802717.8890145984], [408155.49300856225, 1802850.501728053], [408049.4028377986, 1802946.6459453076], [407979.7811632349, 1803029.5288912167], [407963.2045740531, 1803158.826286835], [408022.88029510767, 1803251.6551862531], [408105.7632410168, 1803317.9615429805]]]}}, {"id": "2", "type": "Feature", "properties": {"rr_id": 2, "name": "Region 3"}, "geometry": {"type": "MultiLineString", "coordinates": [[[410254.0891989809, 1802329.9968277444], [410366.81000541727, 1802356.5193704353], [410615.4588431446, 1802366.4653239443], [410761.3328279446, 1802313.4202385624], [410874.053634381, 1802220.5913391444], [410814.37791332643, 1802071.4020365078], [410648.6120215082, 1802005.0956797807], [410532.5758972355, 1802011.7263154534], [410356.86405190814, 1802078.0326721806], [410277.2964238354, 1802187.4381607806], [410254.0891989809, 1802329.9968277444]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file +{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"rr_id": 0, "name": "Region 1"}, "geometry": {"type": "Polygon", "coordinates": [[[403466.64123541984, 1804195.9021819197], [403449.7976758183, 1804409.253936872], [403607.00423209905, 1804515.9298143482], [403865.27214598877, 1804549.6169335512], [403955.1044638635, 1804392.4103772705], [403932.6463843948, 1804201.5167017868], [403792.2833877156, 1804083.6117845762], [403646.3058711692, 1804061.1537051075], [403539.62999369303, 1804094.8408243107], [403466.64123541984, 1804195.9021819197]]]}}, {"id": "1", "type": "Feature", "properties": {"rr_id": 1, "name": "Region 2"}, "geometry": {"type": "Polygon", "coordinates": [[[408105.7632410168, 1803317.9615429805], [408201.9074582713, 1803374.3219461986], [408404.14184628957, 1803251.6551862531], [408397.51121061685, 1803065.9973874167], [408500.2860635441, 1802926.7540382894], [408599.74559863505, 1802837.2404567075], [408719.09704074415, 1802777.564735653], [408735.673629926, 1802731.1502859439], [408652.7906840169, 1802648.267340035], [408503.6013813805, 1802628.3754330166], [408288.10572201683, 1802717.8890145984], [408155.49300856225, 1802850.501728053], [408049.4028377986, 1802946.6459453076], [407979.7811632349, 1803029.5288912167], [407963.2045740531, 1803158.826286835], [408022.88029510767, 1803251.6551862531], [408105.7632410168, 1803317.9615429805]]]}}, {"id": "2", "type": "Feature", "properties": {"rr_id": 2, "name": "Region 3"}, "geometry": {"type": "Polygon", "coordinates": [[[410254.0891989809, 1802329.9968277444], [410366.81000541727, 1802356.5193704353], [410615.4588431446, 1802366.4653239443], [410761.3328279446, 1802313.4202385624], [410874.053634381, 1802220.5913391444], [410814.37791332643, 1802071.4020365078], [410648.6120215082, 1802005.0956797807], [410532.5758972355, 1802011.7263154534], [410356.86405190814, 1802078.0326721806], [410277.2964238354, 1802187.4381607806], [410254.0891989809, 1802329.9968277444]]]}}], "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::2965"}}} \ No newline at end of file