From 8459bd608bddad6ab2aae37702adeafc26f19dc2 Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 8 Nov 2023 14:25:14 +0100 Subject: [PATCH 1/5] Many improvement on OSM module --- .../geoclimate/osm/InputDataFormatting.groovy | 38 +++++++------- .../geoclimate/osm/buildingParams.json | 25 +++++++--- .../osm/InputDataFormattingTest.groovy | 49 +++++++------------ .../geoclimate/osm/WorflowOSMTest.groovy | 17 +++---- 4 files changed, 62 insertions(+), 67 deletions(-) diff --git a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy index 41b96e2343..5c0d624b23 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy @@ -44,7 +44,7 @@ import java.util.regex.Pattern * @return outputTableName The name of the final buildings table * @return outputEstimatedTableName The name of the table containing the state of estimation for each building */ -Map formatBuildingLayer(JdbcDataSource datasource, String building, String zone = "", String urban_areas = "", int h_lev_min = 3, String jsonFilename = null) { +Map formatBuildingLayer(JdbcDataSource datasource, String building, String zone = "", String urban_areas = "", int h_lev_min = 3, String jsonFilename = "") { if (!h_lev_min) { h_lev_min = 3 } @@ -1056,7 +1056,6 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon def coastLinesIntersectsPoints = "coatline_intersect_points_zone${UUID.randomUUID().toString().replaceAll("-", "_")}" def coastLinesPoints = "coatline_points_zone${UUID.randomUUID().toString().replaceAll("-", "_")}" def sea_land_mask = "sea_land_mask${UUID.randomUUID().toString().replaceAll("-", "_")}" - def sea_land_mask_in_zone = "sea_land_mask_in_zone${UUID.randomUUID().toString().replaceAll("-", "_")}" def water_to_be_filtered = "water_to_be_filtered${UUID.randomUUID().toString().replaceAll("-", "_")}" def water_filtered_exploded = "water_filtered_exploded${UUID.randomUUID().toString().replaceAll("-", "_")}" def sea_land_triangles = "sea_land_triangles${UUID.randomUUID().toString().replaceAll("-", "_")}" @@ -1066,10 +1065,10 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon datasource.createSpatialIndex(coastline, "the_geom") datasource.execute """DROP TABLE IF EXISTS $coastLinesIntersects, $islands_mark, $mergingDataTable, $coastLinesIntersectsPoints, $coastLinesPoints,$sea_land_mask, - $sea_land_mask_in_zone,$water_filtered_exploded,$water_to_be_filtered, $sea_land_triangles, $sea_id_triangles, $water_id_triangles; + $water_filtered_exploded,$water_to_be_filtered, $sea_land_triangles, $sea_id_triangles, $water_id_triangles; CREATE TABLE $coastLinesIntersects AS SELECT ST_intersection(a.the_geom, b.the_geom) as the_geom from $coastline AS a, $zone AS b WHERE - a.the_geom && b.the_geom AND st_intersects(a.the_geom, b.the_geom); + a.the_geom && b.the_geom AND st_intersects(a.the_geom, b.the_geom) and "natural"= 'coastline'; """.toString() if (water) { @@ -1088,17 +1087,12 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon UNION ALL SELECT st_tomultiline(the_geom) from $water ; - CREATE TABLE $sea_land_mask (THE_GEOM GEOMETRY,ID serial, TYPE VARCHAR, ZINDEX INTEGER) AS SELECT THE_GEOM, EXPLOD_ID, 'land', 0 AS ZINDEX FROM - st_explode('(SELECT st_polygonize(st_union(ST_NODE(st_accum(the_geom)))) AS the_geom FROM $mergingDataTable)'); """.toString() + st_explode('(SELECT st_polygonize(st_union(ST_NODE(st_accum(the_geom)))) AS the_geom FROM $mergingDataTable)') + as foo where ST_DIMENSION(the_geom) = 2 AND st_area(the_geom) >0; """.toString() datasource.execute """ CREATE SPATIAL INDEX IF NOT EXISTS ${sea_land_mask}_the_geom_idx ON $sea_land_mask (THE_GEOM); - - CREATE TABLE $sea_land_mask_in_zone as select the_geom, id, type, ZINDEX - from st_explode('(SELECT st_intersection(a.THE_GEOM, b.the_geom) as the_geom, a.id, a.type,a.ZINDEX - FROM $sea_land_mask as a, $zone as b WHERE a.the_geom && b.the_geom AND st_intersects(a.the_geom, b.the_geom))') - where ST_DIMENSION(the_geom) = 2 AND st_area(the_geom) >0; CREATE SPATIAL INDEX IF NOT EXISTS ${islands_mark}_the_geom_idx ON $islands_mark (THE_GEOM); @@ -1116,19 +1110,23 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon CREATE TABLE $sea_land_triangles AS SELECT * FROM st_explode('(SELECT CASE WHEN ST_AREA(THE_GEOM) > 100000 THEN ST_Tessellate(the_geom) ELSE THE_GEOM END AS THE_GEOM, - ID, TYPE, ZINDEX FROM $sea_land_mask_in_zone)'); + ID, TYPE, ZINDEX FROM $sea_land_mask)'); CREATE SPATIAL INDEX IF NOT EXISTS ${sea_land_triangles}_the_geom_idx ON $sea_land_triangles (THE_GEOM); DROP TABLE IF EXISTS $sea_id_triangles; CREATE TABLE $sea_id_triangles AS SELECT DISTINCT a.id FROM $sea_land_triangles a, $coastLinesIntersectsPoints b WHERE a.THE_GEOM && b.THE_GEOM AND - st_contains(a.THE_GEOM, b.THE_GEOM); - CREATE INDEX ON $sea_id_triangles (id); - - --Update sea triangles + st_intersects(a.THE_GEOM, b.THE_GEOM); + CREATE INDEX ON $sea_id_triangles (id);""".toString() + + //Set the triangles to sea + datasource.execute """ UPDATE ${sea_land_triangles} SET TYPE='sea' WHERE ID IN(SELECT ID FROM $sea_id_triangles); - + """.toString() + + //Set the triangles to water + datasource.execute """ DROP TABLE IF EXISTS $water_id_triangles; CREATE TABLE $water_id_triangles AS SELECT a.ID FROM ${sea_land_triangles} a, $water b WHERE a.THE_GEOM && b.THE_GEOM AND @@ -1164,7 +1162,7 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon CREATE SPATIAL INDEX IF NOT EXISTS ${sea_land_mask}_the_geom_idx ON $sea_land_mask (THE_GEOM); - CREATE TABLE $sea_land_mask_in_zone as select the_geom, id, type, ZINDEX from st_explode('(SELECT st_intersection(a.THE_GEOM, b.the_geom) as the_geom, a.id, a.type,a.ZINDEX + CREATE TABLE $sea_land_mask as select the_geom, id, type, ZINDEX from st_explode('(SELECT st_intersection(a.THE_GEOM, b.the_geom) as the_geom, a.id, a.type,a.ZINDEX FROM $sea_land_mask as a, $zone as b where a.the_geom && b.the_geom AND st_intersects(a.the_geom, b.the_geom))') where ST_DIMENSION(the_geom) = 2 AND st_area(the_geom) >0; CREATE SPATIAL INDEX IF NOT EXISTS ${islands_mark}_the_geom_idx ON $islands_mark (THE_GEOM); @@ -1186,7 +1184,7 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon CREATE TABLE $sea_land_triangles AS SELECT * FROM st_explode('(SELECT CASE WHEN ST_AREA(THE_GEOM) > 100000 THEN ST_Tessellate(the_geom) ELSE THE_GEOM END AS THE_GEOM, - ID, TYPE, ZINDEX FROM $sea_land_mask_in_zone)'); + ID, TYPE, ZINDEX FROM $sea_land_mask)'); CREATE SPATIAL INDEX IF NOT EXISTS ${sea_land_triangles}_the_geom_idx ON $sea_land_triangles (THE_GEOM); @@ -1209,7 +1207,7 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon datasource.execute("""DROP TABLE IF EXISTS $coastLinesIntersects, $islands_mark, $mergingDataTable, $coastLinesIntersectsPoints, $coastLinesPoints,$sea_land_mask, - $sea_land_mask_in_zone,$water_filtered_exploded,$water_to_be_filtered, $sea_land_triangles, $sea_id_triangles, $water_id_triangles + $water_filtered_exploded,$water_to_be_filtered, $sea_land_triangles, $sea_id_triangles, $water_id_triangles """.toString()) debug 'The sea/land mask has been computed' return outputTableName diff --git a/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json b/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json index eccfc1465a..a8f7a90296 100644 --- a/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json +++ b/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json @@ -1,10 +1,6 @@ { "tags": { - "building": [], - "railway": [ - "station", - "train_station" - ] + "building": [] }, "columns": [ "height", @@ -183,7 +179,7 @@ "! church" ] }, - "sport:entertainment_arts_culture": { + "sport:sport": { "building": [ "swimming_pool", "fitness_centre", @@ -212,7 +208,7 @@ "track" ] }, - "sports_centre:entertainment_arts_culture": { + "sports_centre:sport": { "building": [ "sports_centre", "sports_hall" @@ -344,7 +340,7 @@ "kiosk", "money_transfer", "market", - "market_place", + "marketplace", "pharmacy", "post_office", "retail", @@ -585,6 +581,19 @@ "entertainment_arts_culture": { "leisure": [ "! no" + ], "amenity": [ + "cinema","arts_centre", "brothel", "casino", + "community_centre", "conference_centre", + "events_venue", "exhibition_centre", "gambling", + "music_venue", "nightclub", "planetarium", + "social_centre","studio", "theatre" + ], + "building": [ + "cinema","arts_centre", "brothel", "casino", + "community_centre", "conference_centre", + "events_venue", "exhibition_centre", "gambling", + "music_venue", "nightclub", "planetarium", + "social_centre","studio", "theatre" ] }, "sustenance:commercial": { diff --git a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy index 60feb893c8..e34f563098 100644 --- a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy +++ b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy @@ -309,9 +309,10 @@ class InputDataFormattingTest { //aeroway Toulouse https://www.openstreetmap.org/way/739797641#map=14/43.6316/1.3590 zoneToExtract = [43.610539, 1.334152, 43.648808, 1.392689] - zoneToExtract = "Göteborgs Stad" + zoneToExtract = "Göteborgs Stad" - zoneToExtract = "Barcelona Eixample" + zoneToExtract = "Riantec" + zoneToExtract =[43.637255,1.426635,43.644476,1.437042] //zoneToExtract = [69.24666, 28.3359, 69.32999, 28.41923] @@ -332,37 +333,21 @@ class InputDataFormattingTest { h2GIS.getTable(extractData.zone_envelope).save("${file.absolutePath + File.separator}osm_zone_envelope_${formatedPlaceName}.geojson", true) //Urban Areas - /*format = OSM.InputDataFormatting.formatUrbanAreas() - format.execute([ - datasource : h2GIS, - inputTableName : extractData.results.urbanAreasTableName, - inputZoneEnvelopeTableName: extractData.results.zoneEnvelopeTableName, - epsg : epsg]) - def urbanAreasTableName = format.results.outputTableName; - h2GIS.getTable(format.results.outputTableName).save("./target/osm_urban_areas_${formatedPlaceName}.geojson", true) + def inputUrbanAreas = OSM.InputDataFormatting.formatUrbanAreas(h2GIS, + extractData.urban_areas,extractData.zone) + h2GIS.save(inputUrbanAreas,"./target/osm_urban_areas_${formatedPlaceName}.geojson", true) //Buildings - format = OSM.InputDataFormatting.formatBuildingLayer() - format.execute([ - datasource : h2GIS, - inputTableName : extractData.results.buildingTableName, - inputZoneEnvelopeTableName: extractData.results.zoneEnvelopeTableName, - epsg : epsg, - urbanAreasTableName : urbanAreasTableName]) - h2GIS.getTable(format.results.outputTableName).save("./target/osm_building_${formatedPlaceName}.geojson", true) - assertTrue h2GIS.firstRow("select count(*) as count from ${format.results.outputTableName} where NB_LEV is null").count == 0 - assertTrue h2GIS.firstRow("select count(*) as count from ${format.results.outputTableName} where NB_LEV<0").count == 0 - assertTrue h2GIS.firstRow("select count(*) as count from ${format.results.outputTableName} where HEIGHT_WALL is null").count == 0 - assertTrue h2GIS.firstRow("select count(*) as count from ${format.results.outputTableName} where HEIGHT_WALL<0").count == 0 - assertTrue h2GIS.firstRow("select count(*) as count from ${format.results.outputTableName} where HEIGHT_ROOF is null").count == 0 - assertTrue h2GIS.firstRow("select count(*) as count from ${format.results.outputTableName} where HEIGHT_ROOF<0").count == 0 + h2GIS.save(extractData.building,"${file.absolutePath + File.separator}building_${formatedPlaceName}.geojson", true) + def inputBuildings = OSM.InputDataFormatting.formatBuildingLayer(h2GIS, + extractData.building,extractData.zone,inputUrbanAreas) + h2GIS.save(inputBuildings.building,"${file.absolutePath + File.separator}osm_building_${formatedPlaceName}.geojson", true) //Roads - */ def inputRoadTableName = OSM.InputDataFormatting.formatRoadLayer( h2GIS,extractData.road, extractData.zone_envelope) - h2GIS.getTable(inputRoadTableName).save("${file.absolutePath + File.separator}osm_road_${formatedPlaceName}.geojson", true) + h2GIS.save(inputRoadTableName,"${file.absolutePath + File.separator}osm_road_${formatedPlaceName}.geojson", true) //Rails /*format = OSM.InputDataFormatting.formatRailsLayer() @@ -377,22 +362,26 @@ class InputDataFormattingTest { //Vegetation def inputVegetationTableName = OSM.InputDataFormatting.formatVegetationLayer( h2GIS,extractData.vegetation,extractData.zone_envelope) - h2GIS.getTable(inputVegetationTableName).save("${file.absolutePath + File.separator}osm_vegetation_${formatedPlaceName}.geojson", true) + h2GIS.save(inputVegetationTableName,"${file.absolutePath + File.separator}osm_vegetation_${formatedPlaceName}.geojson", true) //Hydrography def inputWaterTableName = OSM.InputDataFormatting.formatWaterLayer(h2GIS, extractData.water, extractData.zone_envelope) - h2GIS.getTable(inputWaterTableName).save("${file.absolutePath + File.separator}osm_water_${formatedPlaceName}.geojson", true) + h2GIS.save(inputWaterTableName,"${file.absolutePath + File.separator}osm_water_${formatedPlaceName}.geojson", true) //Impervious String imperviousTable = OSM.InputDataFormatting.formatImperviousLayer(h2GIS, extractData.impervious, extractData.zone_envelope) - h2GIS.getTable(imperviousTable).save("${file.absolutePath + File.separator}osm_impervious_${formatedPlaceName}.geojson", true) + h2GIS.save(imperviousTable,"${file.absolutePath + File.separator}osm_impervious_${formatedPlaceName}.geojson", true) + + //Save coastlines to debug + h2GIS.save(extractData.coastline,"${file.absolutePath + File.separator}osm_coastlines_${formatedPlaceName}.geojson", true) + //Sea/Land mask def inputSeaLandTableName = OSM.InputDataFormatting.formatSeaLandMask(h2GIS, extractData.coastline, extractData.zone_envelope, inputWaterTableName) - h2GIS.getTable(inputSeaLandTableName).save("${file.absolutePath + File.separator}osm_sea_land_${formatedPlaceName}.geojson", true) + h2GIS.save(inputSeaLandTableName,"${file.absolutePath + File.separator}osm_sea_land_${formatedPlaceName}.geojson", true) } else { assertTrue(false) diff --git a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/WorflowOSMTest.groovy b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/WorflowOSMTest.groovy index 31a4525c14..02232242c3 100644 --- a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/WorflowOSMTest.groovy +++ b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/WorflowOSMTest.groovy @@ -29,7 +29,6 @@ import org.junit.jupiter.api.io.TempDir import org.orbisgis.data.H2GIS import org.orbisgis.data.POSTGIS import org.orbisgis.geoclimate.Geoindicators -import org.orbisgis.geoclimate.osmtools.OSMTools import static org.junit.jupiter.api.Assertions.* @@ -651,12 +650,12 @@ class WorflowOSMTest extends WorkflowAbstractTest { File dirFile = new File(directory) dirFile.delete() dirFile.mkdir() + def location = "Nice" - def location = "Redon" + //def nominatim = OSMTools.Utilities.getNominatimData("Nantes") - def nominatim = OSMTools.Utilities.getNominatimData("Redon") - - location = nominatim.bbox + location=[47.2, -1.6, 47.4, -1.4] + //location = nominatim.bbox def osm_parmeters = [ "description" : "Example of configuration file to run the OSM workflow and store the result in a folder", @@ -677,8 +676,8 @@ class WorflowOSMTest extends WorkflowAbstractTest { "parameters" : ["distance" : 0, "rsu_indicators" : [ - "indicatorUse": ["LCZ"] //, "UTRF", "TEB"] - ],"grid_indicators": [ + "indicatorUse": ["LCZ", "UTRF", "TEB"] + ]/*,"grid_indicators": [ "x_size": 200, "y_size": 200, //"rowCol": true, @@ -688,13 +687,13 @@ class WorflowOSMTest extends WorkflowAbstractTest { "ROAD_FRACTION", "IMPERVIOUS_FRACTION", "LCZ_PRIMARY", //"BUILDING_HEIGHT_WEIGHTED", //"BUILDING_SURFACE_DENSITY", "SEA_LAND_FRACTION", - "ASPECT_RATIO","SVF", + "ASPECT_RATIO",//"SVF", "HEIGHT_OF_ROUGHNESS_ELEMENTS", "TERRAIN_ROUGHNESS_CLASS"] ], "worldpop_indicators": true, "road_traffic" : true, "noise_indicators" : [ "ground_acoustic": true - ] + ]*/ ] ] OSM.workflow(osm_parmeters) From 8e3f3b80f63dacca649c58d503627b6f71f21412 Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 8 Nov 2023 14:45:35 +0100 Subject: [PATCH 2/5] Identify shelter --- .../org/orbisgis/geoclimate/osm/buildingParams.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json b/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json index a8f7a90296..3304bef094 100644 --- a/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json +++ b/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json @@ -515,6 +515,16 @@ "! no" ] }, + "shelter": { + "amenity": [ + "shelter" + ] + }, + "shelter:transport": { + "shelter_type": [ + "public_transport" + ] + }, "transport": { "building": [ "train_station", From a62fb91d3a6a2805b4b838834839e164fc32b60b Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 8 Nov 2023 14:54:38 +0100 Subject: [PATCH 3/5] Identify roundhouse --- .../resources/org/orbisgis/geoclimate/osm/buildingParams.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json b/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json index 3304bef094..5d32d551b0 100644 --- a/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json +++ b/osm/src/main/resources/org/orbisgis/geoclimate/osm/buildingParams.json @@ -541,7 +541,8 @@ "railway": [ "station", "train_station", - "building" + "roundhouse" + ], "public_transport": [ "train_station", From 83a57820d5e1a1f64250177050b74e87656c0e31 Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 8 Nov 2023 15:56:44 +0100 Subject: [PATCH 4/5] Fix a drop --- .../orbisgis/geoclimate/osm/InputDataFormatting.groovy | 5 +---- .../geoclimate/osm/InputDataFormattingTest.groovy | 8 +++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy index 5c0d624b23..3a0722b2f3 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy @@ -1158,13 +1158,10 @@ String formatSeaLandMask(JdbcDataSource datasource, String coastline, String zon from $zone ; CREATE TABLE $sea_land_mask (THE_GEOM GEOMETRY,ID serial, TYPE VARCHAR, ZINDEX INTEGER) AS SELECT THE_GEOM, EXPLOD_ID, 'land', 0 AS ZINDEX FROM - st_explode('(SELECT st_polygonize(st_union(ST_NODE(st_accum(the_geom)))) AS the_geom FROM $mergingDataTable)'); + st_explode('(SELECT st_polygonize(st_union(ST_NODE(st_accum(the_geom)))) AS the_geom FROM $mergingDataTable)') as foo where ST_DIMENSION(the_geom) = 2 AND st_area(the_geom) >0; CREATE SPATIAL INDEX IF NOT EXISTS ${sea_land_mask}_the_geom_idx ON $sea_land_mask (THE_GEOM); - CREATE TABLE $sea_land_mask as select the_geom, id, type, ZINDEX from st_explode('(SELECT st_intersection(a.THE_GEOM, b.the_geom) as the_geom, a.id, a.type,a.ZINDEX - FROM $sea_land_mask as a, $zone as b where a.the_geom && b.the_geom AND st_intersects(a.the_geom, b.the_geom))') where ST_DIMENSION(the_geom) = 2 AND st_area(the_geom) >0; - CREATE SPATIAL INDEX IF NOT EXISTS ${islands_mark}_the_geom_idx ON $islands_mark (THE_GEOM); CREATE TABLE $coastLinesPoints as SELECT ST_LocateAlong(the_geom, 0.5, -0.01) AS the_geom FROM diff --git a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy index e34f563098..113f19aa4e 100644 --- a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy +++ b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy @@ -216,7 +216,7 @@ class InputDataFormattingTest { //Sea/Land mask String inputSeaLandTableName = OSM.InputDataFormatting.formatSeaLandMask(h2GIS, extractData.coastline, zoneEnvelopeTableName) - assertEquals(4, h2GIS.getTable(inputSeaLandTableName).getRowCount()) + assertEquals(2, h2GIS.getTable(inputSeaLandTableName).getRowCount()) assertTrue h2GIS.firstRow("select count(*) as count from ${inputSeaLandTableName} where type='land'").count == 3 h2GIS.getTable(inputSeaLandTableName).save(new File(folder, "osm_sea_land.geojson").getAbsolutePath(), true) } @@ -312,9 +312,7 @@ class InputDataFormattingTest { zoneToExtract = "Göteborgs Stad" zoneToExtract = "Riantec" - zoneToExtract =[43.637255,1.426635,43.644476,1.437042] - - //zoneToExtract = [69.24666, 28.3359, 69.32999, 28.41923] + zoneToExtract =[45.575525,5.913734,45.578859,5.919549] Map extractData = OSM.InputDataLoading.extractAndCreateGISLayers(h2GIS, zoneToExtract) @@ -335,7 +333,7 @@ class InputDataFormattingTest { //Urban Areas def inputUrbanAreas = OSM.InputDataFormatting.formatUrbanAreas(h2GIS, extractData.urban_areas,extractData.zone) - h2GIS.save(inputUrbanAreas,"./target/osm_urban_areas_${formatedPlaceName}.geojson", true) + h2GIS.save(inputUrbanAreas,"${file.absolutePath + File.separator}osm_urban_areas_${formatedPlaceName}.geojson", true) //Buildings h2GIS.save(extractData.building,"${file.absolutePath + File.separator}building_${formatedPlaceName}.geojson", true) From b46ddd8a939315328d14446c125922b666717eef Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 8 Nov 2023 16:17:49 +0100 Subject: [PATCH 5/5] Fix a expected value --- .../org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy index 113f19aa4e..a15ef82313 100644 --- a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy +++ b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy @@ -217,7 +217,7 @@ class InputDataFormattingTest { //Sea/Land mask String inputSeaLandTableName = OSM.InputDataFormatting.formatSeaLandMask(h2GIS, extractData.coastline, zoneEnvelopeTableName) assertEquals(2, h2GIS.getTable(inputSeaLandTableName).getRowCount()) - assertTrue h2GIS.firstRow("select count(*) as count from ${inputSeaLandTableName} where type='land'").count == 3 + assertTrue h2GIS.firstRow("select count(*) as count from ${inputSeaLandTableName} where type='land'").count == 1 h2GIS.getTable(inputSeaLandTableName).save(new File(folder, "osm_sea_land.geojson").getAbsolutePath(), true) }