diff --git a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy index 25a93eec2b..81f068e9a8 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataFormatting.groovy @@ -455,14 +455,21 @@ String formatVegetationLayer(JdbcDataSource datasource, String vegetation, Strin datasource.eachRow(queryMapper) { row -> def type = getTypeValue(row, columnNames, mappingType) if (type) { - def height_class = typeAndVegClass[type] - def zindex = getZIndex(row."layer") - Geometry geom = row.the_geom - int epsg = geom.getSRID() - for (int i = 0; i < geom.getNumGeometries(); i++) { - Geometry subGeom = geom.getGeometryN(i) - if (subGeom instanceof Polygon && subGeom.getArea()>1) { - stmt.addBatch """ + //Check surface + boolean addGeom = true + if (row."surface" && row."surface" != "grass") { + addGeom=false + } + if (addGeom) { + def height_class = typeAndVegClass[type] + def zindex = getZIndex(row."layer") + + Geometry geom = row.the_geom + int epsg = geom.getSRID() + for (int i = 0; i < geom.getNumGeometries(); i++) { + Geometry subGeom = geom.getGeometryN(i) + if (subGeom instanceof Polygon && subGeom.getArea() > 1) { + stmt.addBatch """ INSERT INTO $outputTableName VALUES( ST_GEOMFROMTEXT('${subGeom}',$epsg), ${rowcount++}, @@ -470,6 +477,7 @@ String formatVegetationLayer(JdbcDataSource datasource, String vegetation, Strin ${singleQuote(type)}, ${singleQuote(height_class)}, ${zindex}) """.toString() + } } } } diff --git a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataLoading.groovy b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataLoading.groovy index e2998e4c3d..113d0d45b3 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataLoading.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/InputDataLoading.groovy @@ -99,7 +99,7 @@ Map extractAndCreateGISLayers(JdbcDataSource datasource, Object zoneToExtract, f def keysValues = ["building", "railway", "amenity", "leisure", "highway", "natural", "landuse", "landcover", - "vegetation", "waterway", "area", "aeroway", "area:aeroway"] + "vegetation", "waterway", "area", "aeroway", "area:aeroway", "tourism", "sport"] query = "[maxsize:1073741824]" + OSMTools.Utilities.buildOSMQueryWithAllData(envelope, keysValues, OSMElement.NODE, OSMElement.WAY, OSMElement.RELATION) } 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 42b221d391..95e27e96f7 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy @@ -439,7 +439,7 @@ Map osm_processing(JdbcDataSource h2gis_datasource, def processing_parameters, d def keysValues = ["building", "railway", "amenity", "leisure", "highway", "natural", "landuse", "landcover", - "vegetation", "waterway", "area", "aeroway", "area:aeroway"] + "vegetation", "waterway", "area", "aeroway", "area:aeroway", "tourism", "sport"] query = "[timeout:$overpass_timeout][maxsize:$overpass_maxsize]" + OSMTools.Utilities.buildOSMQueryWithAllData(zones.envelope, keysValues, OSMElement.NODE, OSMElement.WAY, OSMElement.RELATION) } diff --git a/osm/src/main/resources/org/orbisgis/geoclimate/osm/vegetParams.json b/osm/src/main/resources/org/orbisgis/geoclimate/osm/vegetParams.json index 7e47fc9ace..3cfca259e7 100644 --- a/osm/src/main/resources/org/orbisgis/geoclimate/osm/vegetParams.json +++ b/osm/src/main/resources/org/orbisgis/geoclimate/osm/vegetParams.json @@ -46,7 +46,9 @@ "produce": [], "surface": [ "grass" - ] + ], + "tourism": ["camp_site"], + "sport": [] }, "columns": [ "natural", @@ -63,7 +65,9 @@ "produce", "layer", "surface", - "leisure" + "leisure", + "tourism", + "sport" ], "type": { "farmland": { @@ -121,7 +125,9 @@ ], "surface": [ "grass" - ] + ], + "tourism": ["camp_site"], + "sport": ["soccer", "rugby"] }, "grassland": { "landcover": [ diff --git a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy index ff28aa838a..96b00c42fb 100644 --- a/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy +++ b/osm/src/test/groovy/org/orbisgis/geoclimate/osm/InputDataFormattingTest.groovy @@ -311,7 +311,7 @@ class InputDataFormattingTest { zoneToExtract = "Göteborgs Stad" - zoneToExtract = "Dijon" + zoneToExtract = "Ploemeur" //zoneToExtract = [69.24666, 28.3359, 69.32999, 28.41923]