Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Script recalcul calque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ERASME
Script recalcul calque
Commits
002bc50f
Commit
002bc50f
authored
2 years ago
by
Romain MATIAS
Browse files
Options
Downloads
Patches
Plain Diff
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
1 year ago
Stage: Build Calqul
Stage: Deploy Calqul Buttons
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Dockerfiles/db/db-init/sql/30-create_tables.sql
+20
-1
20 additions, 1 deletion
Dockerfiles/db/db-init/sql/30-create_tables.sql
Dockerfiles/python/scripts/main.py
+22
-27
22 additions, 27 deletions
Dockerfiles/python/scripts/main.py
with
42 additions
and
28 deletions
Dockerfiles/db/db-init/sql/30-create_tables.sql
+
20
−
1
View file @
002bc50f
...
@@ -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
This diff is collapsed.
Click to expand it.
Dockerfiles/python/scripts/main.py
+
22
−
27
View file @
002bc50f
...
@@ -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
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment