Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ebocher committed Nov 15, 2023
1 parent 98ea258 commit 7ee2abc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 7ee2abc

Please sign in to comment.