Skip to content

Commit

Permalink
Fix street_width indicators to be executed
Browse files Browse the repository at this point in the history
  • Loading branch information
ebocher committed Nov 15, 2024
1 parent 2130a9e commit fb0da22
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
Expand All @@ -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.")
}
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fb0da22

Please sign in to comment.