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
5803e3ae
Commit
5803e3ae
authored
Jan 26, 2022
by
Danijel Schorlemmer
Browse files
Improved the district import SQL query
parent
a6303c05
Pipeline
#37794
passed with stage
in 1 minute and 34 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.pylintrc
0 → 100644
View file @
5803e3ae
[MASTER]
init-hook='import sys; sys.path.append("exposurejapan")'
exposurejapan/database.py
View file @
5803e3ae
...
...
@@ -20,7 +20,7 @@ import logging
from
exposurelib.database
import
SpatialiteDatabase
import
pandas
import
numpy
from
exposurejapan
import
constants
import
constants
import
shapely.wkt
import
pyproj
from
shapely.ops
import
transform
...
...
@@ -650,10 +650,10 @@ class JapanDatabase(SpatialiteDatabase):
# From the boundary database select admin_id, name and geometry
# and insert into Districts table in the Japan database
sql_statement
=
"INSERT INTO District (id, admin_id, name, geom) "
sql_statement
+=
"SELECT DISTINCT key_code_ward, key_code_ward, CITY_NAME,
"
sql_statement
+=
(
"ST_Transform(CastToMultiPolygon(GeomFrom
Text(AsWKT(CastAutomagic
(geom)
)
, %d)), "
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
)
)
sql_statement
+=
"FROM BoundaryDatabase.Boundary"
...
...
exposurejapan/exposurejapan.py
View file @
5803e3ae
...
...
@@ -20,7 +20,7 @@
import
logging
import
sys
import
sqlite3
from
.
database
import
JapanDatabase
# pylint: disable=E0611,E0401
from
database
import
JapanDatabase
# pylint: disable=E0611,E0401
# Add a logger printing error, warning, info and debug messages to the screen
...
...
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