diff --git a/bdtopo/src/main/groovy/org/orbisgis/geoclimate/bdtopo/AbstractBDTopoWorkflow.groovy b/bdtopo/src/main/groovy/org/orbisgis/geoclimate/bdtopo/AbstractBDTopoWorkflow.groovy index e0acdfea48..a3976981f3 100644 --- a/bdtopo/src/main/groovy/org/orbisgis/geoclimate/bdtopo/AbstractBDTopoWorkflow.groovy +++ b/bdtopo/src/main/groovy/org/orbisgis/geoclimate/bdtopo/AbstractBDTopoWorkflow.groovy @@ -556,9 +556,9 @@ abstract class AbstractBDTopoWorkflow extends BDTopoUtils { def allowed_grid_indicators = ["BUILDING_FRACTION", "BUILDING_HEIGHT", "BUILDING_POP", "BUILDING_TYPE_FRACTION", "WATER_FRACTION", "VEGETATION_FRACTION", "ROAD_FRACTION", "IMPERVIOUS_FRACTION", "UTRF_AREA_FRACTION", "UTRF_FLOOR_AREA_FRACTION", "LCZ_FRACTION", "LCZ_PRIMARY", "FREE_EXTERNAL_FACADE_DENSITY", "BUILDING_HEIGHT_WEIGHTED", "BUILDING_SURFACE_DENSITY", - "BUILDING_HEIGHT_DIST", "FRONTAL_AREA_INDEX", "SEA_LAND_FRACTION", "ASPECT_RATIO", + "BUILDING_HEIGHT_DISTRIBUTION", "FRONTAL_AREA_INDEX", "SEA_LAND_FRACTION", "ASPECT_RATIO", "SVF", "HEIGHT_OF_ROUGHNESS_ELEMENTS", "TERRAIN_ROUGHNESS_CLASS", "URBAN_SPRAWL_AREAS", - "URBAN_SPRAWL_DISTANCES", "URBAN_SPRAWL_COOL_DISTANCES"] + "URBAN_SPRAWL_DISTANCES", "URBAN_SPRAWL_COOL_DISTANCES", "STREET_WIDTH"] def allowedOutputIndicators = allowed_grid_indicators.intersect(list_indicators*.toUpperCase()) if (allowedOutputIndicators) { //Update the RSU indicators list according the grid indicators diff --git a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy index 85ef13d3d1..e8c95ed18c 100644 --- a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy +++ b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy @@ -1294,7 +1294,7 @@ Map computeAllGeoIndicators(JdbcDataSource datasource, String zone, String build if (!geoIndicators) { error "Cannot build the geoindicators" datasource.dropTable(blocksForGeoCalc, rsuForGeoCalc, buildingIndicatorsForHeightEst, rsuIndicatorsForHeightEst) - return + return null } else { //Clean the System properties that stores intermediate table names datasource.dropTable(getCachedTableNames()) @@ -1689,22 +1689,30 @@ String rasterizeIndicators(JdbcDataSource datasource, || it == "BUILDING_SURFACE_DENSITY" || it == "ASPECT_RATIO" || it == "FREE_EXTERNAL_FACADE_DENSITY" || it == "STREET_WIDTH") { columnFractionsList.put(priorities.indexOf("building"), "building") - } else if (it == "WATER_FRACTION") { + } + if (it == "WATER_FRACTION") { columnFractionsList.put(priorities.indexOf("water"), "water") - } else if (it == "VEGETATION_FRACTION") { + } + if (it == "VEGETATION_FRACTION") { columnFractionsList.put(priorities.indexOf("high_vegetation"), "high_vegetation") columnFractionsList.put(priorities.indexOf("low_vegetation"), "low_vegetation") - } else if (it == "ROAD_FRACTION") { + } + if (it == "ROAD_FRACTION") { columnFractionsList.put(priorities.indexOf("road"), "road") - } else if (it == "IMPERVIOUS_FRACTION") { + } + if (it == "IMPERVIOUS_FRACTION") { columnFractionsList.put(priorities.indexOf("impervious"), "impervious") - } else if (it == "BUILDING_HEIGHT" && building) { + } + if (it == "BUILDING_HEIGHT" && building) { height_roof_unweighted_list.addAll(["AVG", "STD"]) - } else if (it == "BUILDING_HEIGHT_WEIGHTED" && building) { + } + if ((it == "BUILDING_HEIGHT_WEIGHTED" || it == "STREET_WIDTH") && building) { weightedBuildingIndicators["height_roof"] = ["area": ["AVG", "STD"]] - } else if (it == "BUILDING_POP" && building) { + } + if (it == "BUILDING_POP" && building) { unweightedBuildingIndicators.put("pop", ["SUM"]) - } else if (it == "HEIGHT_OF_ROUGHNESS_ELEMENTS" && building) { + } + if (it == "HEIGHT_OF_ROUGHNESS_ELEMENTS" && building) { height_roof_unweighted_list.add("GEOM_AVG") } } diff --git a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy index 6e03e86846..615cfa2de8 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy @@ -871,10 +871,10 @@ def extractProcessingParameters(def processing_parameters) throws Exception { def allowed_grid_indicators = ["BUILDING_FRACTION", "BUILDING_HEIGHT", "BUILDING_POP", "BUILDING_TYPE_FRACTION", "WATER_FRACTION", "VEGETATION_FRACTION", "ROAD_FRACTION", "IMPERVIOUS_FRACTION", "UTRF_AREA_FRACTION", "UTRF_FLOOR_AREA_FRACTION", "LCZ_FRACTION", "LCZ_PRIMARY", "FREE_EXTERNAL_FACADE_DENSITY", - "BUILDING_HEIGHT_WEIGHTED", "BUILDING_SURFACE_DENSITY", "BUILDING_HEIGHT_DIST", + "BUILDING_HEIGHT_WEIGHTED", "BUILDING_SURFACE_DENSITY", "BUILDING_HEIGHT_DISTRIBUTION", "FRONTAL_AREA_INDEX", "SEA_LAND_FRACTION", "ASPECT_RATIO", "SVF", "HEIGHT_OF_ROUGHNESS_ELEMENTS", "TERRAIN_ROUGHNESS_CLASS", "URBAN_SPRAWL_AREAS", - "URBAN_SPRAWL_DISTANCES", "URBAN_SPRAWL_COOL_DISTANCES"] + "URBAN_SPRAWL_DISTANCES", "URBAN_SPRAWL_COOL_DISTANCES","STREET_WIDTH"] def allowedOutputIndicators = allowed_grid_indicators.intersect(list_indicators*.toUpperCase()) if (allowedOutputIndicators) { //Update the RSU indicators list according the grid indicators 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 fdc30a15bc..08ccf6b4c8 100644 --- a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/WorflowOSMTest.groovy +++ b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/WorflowOSMTest.groovy @@ -29,6 +29,7 @@ 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.* @@ -649,9 +650,10 @@ class WorflowOSMTest extends WorkflowAbstractTest { File dirFile = new File(directory) dirFile.delete() dirFile.mkdir() - def location = "Hesdin" - def nominatim = org.orbisgis.geoclimate.osmtools.OSMTools.Utilities.getNominatimData(location) + def location = "Nantes" + def nominatim = OSMTools.Utilities.getNominatimData(location) def grid_size = 100 + location =[47.214976592711274,-1.6425595375815742,47.25814872718718,-1.5659501122281323] //location = nominatim.bbox //location=[51.2, 1.0, 51.4, 1.2] /* location =[ 48.84017284026897, @@ -695,8 +697,8 @@ class WorflowOSMTest extends WorkflowAbstractTest { "indicators": [ "BUILDING_FRACTION", "BUILDING_HEIGHT", - "BUILDING_POP", - "BUILDING_TYPE_FRACTION", + //"BUILDING_POP", + //"BUILDING_TYPE_FRACTION", "WATER_FRACTION", "VEGETATION_FRACTION", "ROAD_FRACTION", @@ -705,7 +707,11 @@ class WorflowOSMTest extends WorkflowAbstractTest { "LCZ_PRIMARY", "SEA_LAND_FRACTION", "ASPECT_RATIO", - "SVF" ] + //"SVF", + "STREET_WIDTH" , + "IMPERVIOUS_FRACTION", + "high_vegetation", + "LOW_vegetation"] //"lcz_lod":1 ], "worldpop_indicators": true /* diff --git a/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy b/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy index d29497d1be..c46841c6c2 100644 --- a/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy +++ b/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy @@ -33,10 +33,10 @@ import org.orbisgis.geoclimate.utils.AbstractScript */ abstract class OSMTools extends AbstractScript { - static Loader Loader = new Loader() - static Transform Transform = new Transform() - static Utilities Utilities = new Utilities() - static TransformUtils TransformUtils = new TransformUtils() + public static Loader Loader = new Loader() + public static Transform Transform = new Transform() + public static Utilities Utilities = new Utilities() + public static TransformUtils TransformUtils = new TransformUtils() OSMTools() { } diff --git a/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/utils/Utilities.groovy b/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/utils/Utilities.groovy index d572ca9509..88fd0fdaed 100644 --- a/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/utils/Utilities.groovy +++ b/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/utils/Utilities.groovy @@ -288,7 +288,7 @@ boolean executeNominatimQuery(def query, def outputOSMFile) throws Exception { * * @return OSM bbox. */ -String toBBox(Geometry geometry) throws Exception { + String toBBox(Geometry geometry) throws Exception { if (!geometry) { throw new Exception("Cannot convert to an overpass bounding box.") } @@ -307,7 +307,7 @@ String toBBox(Geometry geometry) throws Exception { * * @return The OSM polygon. */ -String toPoly(Geometry geometry) throws Exception { + String toPoly(Geometry geometry) throws Exception { if (!geometry) { throw new Exception("Cannot convert to an overpass poly filter.") } @@ -587,7 +587,7 @@ Geometry buildGeometry(def bbox) { * @param bbox 4 values * @return a JTS polygon */ -//TODO why not merging methods +//TODO: why not merging methods Geometry geometryFromNominatim(def bbox) { if (!bbox) { error "The latitude and longitude values cannot be null or empty"