Skip to content

Commit

Permalink
issue988
Browse files Browse the repository at this point in the history
  • Loading branch information
BERNARD Jeremy committed Jul 5, 2024
1 parent a323350 commit ffd442d
Show file tree
Hide file tree
Showing 2 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 WHERE commune").the_geom
if (geom == null) {
dataSource.execute("""INSERT INTO $logTableZones
Geometry geom = dataSource.firstRow("SELECT st_union(st_accum(THE_GEOM)) as the_geom FROM commune").the_geom
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 @@ -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 = [[6961277.075588564, 653602.1968784243, 6962277.075588564, 654602.1968784243],
[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 ffd442d

Please sign in to comment.