Skip to content

Commit

Permalink
Merge pull request #990 from j3r3m1/issue988
Browse files Browse the repository at this point in the history
Issue988
  • Loading branch information
ebocher authored Jul 5, 2024
2 parents 51c1bae + 94925de commit 71bbc70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ abstract class AbstractBDTopoWorkflow extends BDTopoUtils {
}
}
} catch (Exception e) {
saveLogZoneTable(h2gis_datasource, databaseFolder, location, e.getLocalizedMessage())
saveLogZoneTable(h2gis_datasource, databaseFolder, location in Collection ? location.join("_") : location, e.getLocalizedMessage())
//eat the exception and process other zone
warn("The zone $location has not been processed. Please check the log table to get more informations.")
}
Expand Down Expand Up @@ -268,7 +268,7 @@ abstract class AbstractBDTopoWorkflow extends BDTopoUtils {
}
}
} catch (Exception e) {
saveLogZoneTable(h2gis_datasource, databaseFolder, location, e.getLocalizedMessage())
saveLogZoneTable(h2gis_datasource, databaseFolder, location in Collection ? location.join("_") : location, e.getLocalizedMessage())
//eat the exception and process other zone
warn("The zone $location has not been processed. Please check the log table to get more informations.")
}
Expand All @@ -293,23 +293,23 @@ abstract class AbstractBDTopoWorkflow extends BDTopoUtils {
void saveLogZoneTable(JdbcDataSource dataSource, String databaseFolder, String location, String message) throws Exception {
def logTableZones = postfix("log_zones")
//Create the table to log on the processed zone
dataSource.execute("""DROP TABLE IF EXISTS $logTableZones;
dataSource """DROP TABLE IF EXISTS $logTableZones;
CREATE TABLE $logTableZones (the_geom GEOMETRY(GEOMETRY, 4326),
location VARCHAR, info VARCHAR, version VARCHAR, build_number VARCHAR);""")
location VARCHAR, info VARCHAR, version VARCHAR, build_number VARCHAR);"""
//Find the geometry of the location
Geometry geom = dataSource.firstRow("SELECT st_union(st_accum(THE_GEOM)) as the_geom FROM commune").the_geom
if (geom == null) {
dataSource.execute("""INSERT INTO $logTableZones
if (geom == null | geom.isEmpty()) {
dataSource """INSERT INTO $logTableZones
VALUES(null,'$location', '$message',
'${Geoindicators.version()}',
'${Geoindicators.buildNumber()}')""")
'${Geoindicators.buildNumber()}')"""
} else {
dataSource.execute("""INSERT INTO $logTableZones
dataSource """INSERT INTO $logTableZones
VALUES(st_geomfromtext('${geom}',${geom.getSRID()}) ,'$location', '$message',
'${Geoindicators.version()}',
'${Geoindicators.buildNumber()}')""")
'${Geoindicators.buildNumber()}')"""
}
dataSource.save(logTableZones, databaseFolder + File.separator + "log_zones_" + id_zone + ".fgb", true)
dataSource.save(logTableZones, databaseFolder + File.separator + "log_zones_" + location + ".fgb", true)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def filterLinkedShapeFiles(def location, float distance, LinkedHashMap inputTabl
return true

} else {
throw new Exception("Cannot find any commune with the insee code : $location")
throw new Exception("Cannot find any commune for the following bbox or insee code : $location")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ class WorkflowDebugTest {
@Disabled
@Test
void testIntegrationFolderInput() {
def input_data = "/home/decide/Data/URBIO/Donnees_brutes/BD_TOPO/BDTOPO_3-3_TOUSTHEMES_SHP_LAMB93_D076_2024-03-15"
def locations = ["76005", "76020"]
def input_data = "/home/bernardj/Data/BDT/V3/BDTOPO_3-3_TOUSTHEMES_SHP_LAMB93_R11_2024-03-15"
def locations = [
[6864452.136340265, 651978.2850116278, 6865452.136340265, 652978.2850116278]]
String directory = "/tmp/bdtopo3"
File dirFile = new File(directory)
dirFile.delete()
Expand Down

0 comments on commit 71bbc70

Please sign in to comment.