diff --git a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/SpatialUnits.groovy b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/SpatialUnits.groovy index b6fa625506..f73a388d89 100644 --- a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/SpatialUnits.groovy +++ b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/SpatialUnits.groovy @@ -184,7 +184,7 @@ String prepareTSUData(JdbcDataSource datasource, String zone, String road, Strin return } - if (surface_urban_areas < 10000) { + if (surface_urban_areas <= 100) { error("The surface of urban areas must be greater or equal than 100 m²") return } 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 897625ee1d..bb9c4795f6 100644 --- a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy +++ b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy @@ -1368,8 +1368,8 @@ Map estimateBuildingHeight(JdbcDataSource datasource, String zone, String buildi String road, String rail, String vegetation, String water, String impervious, String building_estimate, String sea_land_mask, String urban_areas, String rsu, - double surface_vegetation, double surface_hydro, - double snappingTolerance, double surface_urban_areas, String buildingHeightModelName, String prefixName = "") { + double surface_vegetation, double surface_hydro,double surface_urban_areas, + double snappingTolerance, String buildingHeightModelName, String prefixName = "") { if (!building_estimate) { error "To estimate the building height a table that contains the list of building to estimate must be provided" return 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 41599c3184..6b11f1d42c 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 @@ -269,11 +269,7 @@ boolean executeNominatimQuery(def query, def outputOSMFile) { connection = url.openConnection() } connection.requestMethod = "GET" - def user_agent = System.getProperty("OVERPASS_USER_AGENT") - if (!user_agent) { - user_agent = OSM_USER_AGENT - } - connection.setRequestProperty("User-Agent", user_agent) + connection.setRequestProperty("User-Agent", "GEOCLIMATE_${System.currentTimeMillis()}") connection.connect() @@ -691,9 +687,6 @@ static @Field OVERPASS_BASE_URL = "${OVERPASS_ENDPOINT}/interpreter?data=" /** Url of the status of the Overpass server */ static @Field OVERPASS_STATUS_URL = "${OVERPASS_ENDPOINT}/status" -/** Default user agent*/ -static @Field OSM_USER_AGENT = "geoclimate" - /** OVERPASS TIMEOUT */ static @Field int OVERPASS_TIMEOUT = 180 /** @@ -760,11 +753,7 @@ boolean executeOverPassQuery(URL queryUrl, def outputOSMFile) { timeout = (int) TimeUnit.MINUTES.toMillis(3); } - def user_agent = System.getProperty("OVERPASS_USER_AGENT") - if (!user_agent) { - user_agent = OSM_USER_AGENT - } - connection.setRequestProperty("User-Agent", user_agent) + connection.setRequestProperty("User-Agent", "GEOCLIMATE_${System.currentTimeMillis()}") connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); @@ -826,11 +815,8 @@ boolean executeOverPassQuery(def query, def outputOSMFile) { } else { timeout = (int) TimeUnit.MINUTES.toMillis(3); } - def user_agent = System.getProperty("OVERPASS_USER_AGENT") - if (!user_agent) { - user_agent = OSM_USER_AGENT - } - connection.setRequestProperty("User-Agent", user_agent) + connection.setRequestProperty("User-Agent", "GEOCLIMATE_${System.currentTimeMillis()}") + connection.setConnectTimeout(timeout) connection.setReadTimeout(timeout) diff --git a/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/UtilitiesTest.groovy b/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/UtilitiesTest.groovy index 9283647425..15b6e06e92 100644 --- a/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/UtilitiesTest.groovy +++ b/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/UtilitiesTest.groovy @@ -548,12 +548,12 @@ class UtilitiesTest extends AbstractOSMToolsTest { @Disabled void getNominatimDataTest() { def pattern = Pattern.compile("^POLYGON \\(\\((?>-?\\d+(?>\\.\\d+)? -?\\d+(?>\\.\\d+)?(?>, )?)*\\)\\)\$") - def data = Utilities.getNominatimData("Paimpol") + def data = OSMTools.Utilities.getNominatimData("Paimpol") assertTrue pattern.matcher(data["geom"].toString()).matches() Envelope env = data["geom"].getEnvelopeInternal() assertEquals([env.getMinY(), env.getMinX(), env.getMaxY(), env.getMaxX()].toString(), data["bbox"].toString()) assertEquals(data["extratags"]["ref:INSEE"], "22162") - data = Utilities.getNominatimData("Boston") + data = OSMTools.Utilities.getNominatimData("Boston") assertTrue pattern.matcher(data["geom"].toString()).matches() assertEquals(data["extratags"]["population"], "689326") }