Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
Global Dynamic Exposure
exposure-japan
Commits
6ba9d0a4
Commit
6ba9d0a4
authored
Jan 27, 2022
by
Danijel Schorlemmer
Browse files
Simplified the SQL query copying geometries from the Geopackage file
parent
5803e3ae
Pipeline
#37809
passed with stage
in 1 minute and 37 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
exposurejapan/database.py
View file @
6ba9d0a4
...
...
@@ -641,7 +641,7 @@ class JapanDatabase(SpatialiteDatabase):
File path to the boundary file
"""
# Attach
g
eopackage boundary database to the Japan database
# Attach
G
eopackage boundary database to the Japan database
sql_statement
=
"SELECT EnableGpkgAmphibiousMode();"
self
.
connection
.
execute
(
sql_statement
)
sql_statement
=
"ATTACH '%s' AS BoundaryDatabase"
%
district_boundary_filepath
...
...
@@ -653,8 +653,8 @@ class JapanDatabase(SpatialiteDatabase):
sql_statement
=
(
"INSERT INTO District (id, admin_id, name, geom) "
"SELECT key_code_ward, key_code_ward, CITY_NAME, "
"ST_Transform(CastToMultiPolygon(GeomFrom
WKB(AsBinary(geom), %d
)), "
"%d) "
%
(
constants
.
JGD2000
,
constants
.
WGS84
)
"ST_Transform(CastToMultiPolygon(GeomFrom
GPB(geom
)), "
"%d) "
%
constants
.
WGS84
)
sql_statement
+=
"FROM BoundaryDatabase.Boundary"
logger
.
debug
(
sql_statement
)
...
...
@@ -680,7 +680,7 @@ class JapanDatabase(SpatialiteDatabase):
self
.
cursor
.
execute
(
sql_statement
)
self
.
connection
.
commit
()
# Detach
g
eopackage boundary database from the Japan database
# Detach
G
eopackage boundary database from the Japan database
sql_statement
=
"DETACH DATABASE 'BoundaryDatabase'"
logger
.
debug
(
sql_statement
)
self
.
connection
.
execute
(
sql_statement
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment