Skip to content
Snippets Groups Projects
Commit 002bc50f authored by Romain MATIAS's avatar Romain MATIAS
Browse files

wip: Add manually IGN building in Exo-Dev Server

parent 6c359372
No related branches found
No related tags found
No related merge requests found
Pipeline #66329 passed with warnings
...@@ -123,4 +123,23 @@ CREATE INDEX CONCURRENTLY datas_geom_index ON base.datas USING GIST (geom_poly); ...@@ -123,4 +123,23 @@ CREATE INDEX CONCURRENTLY datas_geom_index ON base.datas USING GIST (geom_poly);
CREATE INDEX tiles_insee ON base.tiles USING btree (insee); CREATE INDEX tiles_insee ON base.tiles USING btree (insee);
CREATE INDEX tiles_factors_id_factor ON base.tiles_factors USING btree (id_factor); CREATE INDEX tiles_factors_id_factor ON base.tiles_factors USING btree (id_factor);
CREATE INDEX tiles_factors_id_tiles ON base.tiles_factors USING btree (id_tile); CREATE INDEX tiles_factors_id_tiles ON base.tiles_factors USING btree (id_tile);
\ No newline at end of file
-- ------------------------
-- CUSTOM TABLES
-- ------------------------
CREATE TABLE base.bati
(
id serial PRIMARY KEY,
strid character varying(255) NULL,
nature character varying(255) NULL,
usage_1 character varying(255) NULL,
hauteur character varying(255) NULL,
altitude_minimale_sol character varying(255) NULL,
geom_poly geometry(Polygon) NOT NULL
);
-- hauteur real NULL,
-- altitude_minimale_sol real NULL,
CREATE INDEX CONCURRENTLY bati_geom_index ON base.bati (geom_poly);
\ No newline at end of file
...@@ -93,34 +93,24 @@ def test(communesArrayInput=None): ...@@ -93,34 +93,24 @@ def test(communesArrayInput=None):
# Init # Init
retcode = None retcode = None
print('communesArrayInput') # print('communesArrayInput')
print(communesArrayInput) # print(communesArrayInput)
print(type(communesArrayInput)) # print(type(communesArrayInput))
# communesArrayCasted = communesArrayInput.split(',') # communesArrayCasted = communesArrayInput.split(',')
# print('\n communesArrayCasted') # print('\n communesArrayCasted')
# print(communesArrayCasted) # print(communesArrayCasted)
# print(type(communesArrayCasted)) # print(type(communesArrayCasted))
multiProcessFactors(communesArrayInput) # multiProcessFactors(communesArrayInput)
return retcode
def testDBConnexion():
# Init
retcode = None
print(style.BLUE + "Try to connect to database : {} - {} \n".format(DB_params['host'], DB_params['database']), style.RESET)
# Connect DB
# conn, cur = connectDB(DB_params)
# Column list for GDF & DB # Column list for GDF & DB
columnsListToDB = ('strid', 'nature', 'hauteur', 'geom_poly') columnsListToDB = ('strid', 'nature', 'usage_1', 'hauteur', 'altitude_minimale_sol', 'geom_poly')
columnsArrFromGeoJSON = ['id', 'nature', 'hauteur', 'geometry'] columnsArrFromGeoJSON = ['ID', 'NATURE', 'USAGE1', 'HAUTEUR', 'Z_MIN_SOL', 'geometry']
# Load geojson file in Dataframe # Load geojson file in Dataframe
batiGDF = createGDFfromGeoJSON("./tmp/BATIMENT.shp") batiGDF = createGDFfromGeoJSON("./tmp/bati_sans_z.shp")
print(batiGDF)
if batiGDF is not None: if batiGDF is not None:
# Clean useless attribute # Clean useless attribute
...@@ -132,17 +122,22 @@ def testDBConnexion(): ...@@ -132,17 +122,22 @@ def testDBConnexion():
# Convert to WKT # Convert to WKT
batiGDF = convertGeomToWKT(batiGDF) batiGDF = convertGeomToWKT(batiGDF)
# PGL - Debug
# with open('/app/tmp/dump_communes_gl.wkt', 'w') as f:
# f.write(str(batiGDF))
# f.close()
# /PGL - Debug
# Insert in DB # Insert in DB
insertGDFintoDB(DB_params, DB_schema, batiGDF, 'bati', columnsListToDB) insertGDFintoDB(DB_params, DB_schema, batiGDF, 'bati', columnsListToDB)
return retcode
def testDBConnexion():
# Init
retcode = None
print(style.BLUE + "Try to connect to database : {} - {} \n".format(DB_params['host'], DB_params['database']), style.RESET)
# Connect DB
conn, cur = connectDB(DB_params)
# Close DB # Close DB
# closeDB(conn, cur) closeDB(conn, cur)
return_error_and_exit_job(-1) return_error_and_exit_job(-1)
...@@ -1124,8 +1119,8 @@ def main(): ...@@ -1124,8 +1119,8 @@ def main():
else: else:
debugLog(style.RED, "The grid size value is not a number. Please correct your input") debugLog(style.RED, "The grid size value is not a number. Please correct your input")
elif firstArgv == 'test': elif firstArgv == 'test':
secArgv = sys.argv[1:][1] # secArgv = sys.argv[1:][1]
test(secArgv) test()
elif firstArgv == 'testDB': elif firstArgv == 'testDB':
testDBConnexion() testDBConnexion()
elif firstArgv == 'help': elif firstArgv == 'help':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment