diff --git a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/RsuIndicators.groovy b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/RsuIndicators.groovy index 62919539b4..81701554a1 100644 --- a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/RsuIndicators.groovy +++ b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/RsuIndicators.groovy @@ -170,13 +170,24 @@ String freeExternalFacadeDensityExact(JdbcDataSource datasource, String building // 4. Calculates the free facade density by RSU (subtract 3 and 2 and divide by RSU area) datasource.createIndex(buildLineRsu,idRsu) datasource.createIndex(sharedLineRsu,idRsu) - datasource """ + if(datasource.getRowCount(sharedLineRsu)>0) { + datasource """ DROP TABLE IF EXISTS $onlyBuildRsu; CREATE TABLE $onlyBuildRsu AS SELECT a.$idRsu, (a.$FACADE_AREA-b.$FACADE_AREA)/a.$RSU_AREA AS FREE_EXTERNAL_FACADE_DENSITY FROM $buildLineRsu AS a LEFT JOIN $sharedLineRsu AS b - ON a.$idRsu = b.$idRsu""".toString() + ON a.$idRsu = b.$idRsu + """.toString() + }else{ + datasource """ + DROP TABLE IF EXISTS $onlyBuildRsu; + CREATE TABLE $onlyBuildRsu + AS SELECT $idRsu, + $FACADE_AREA/$RSU_AREA AS FREE_EXTERNAL_FACADE_DENSITY + FROM $buildLineRsu + """.toString() + } // 5. Join RSU having no buildings and set their value to 0 datasource.createIndex(onlyBuildRsu,idRsu) 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 c483927913..298d4f12f5 100644 --- a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy +++ b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy @@ -1613,7 +1613,7 @@ Map computeGeoclimateIndicators(JdbcDataSource datasource, String zone, String b * @return */ String rasterizeIndicators(JdbcDataSource datasource, - String grid, List list_indicators = [], + String grid, List list_indicators, String building, String road, String vegetation, String water, String impervious, String rsu_lcz, String rsu_utrf_area, String rsu_utrf_floor_area, String sea_land_mask, @@ -1822,7 +1822,7 @@ String rasterizeIndicators(JdbcDataSource datasource, } - if (list_indicators_upper.contains("BUILDING_TYPE") && building) { + if (list_indicators_upper.contains("BUILDING_TYPE_FRACTION") && building) { if (!buildingCutted) { buildingCutted = cutBuilding(datasource, grid, building) if (!buildingCutted) { @@ -1838,6 +1838,7 @@ String rasterizeIndicators(JdbcDataSource datasource, "building_type_fraction") if (upperScaleAreaStatistics) { indicatorTablesToJoin.put(upperScaleAreaStatistics, grid_column_identifier) + tablesToDrop<