Commit 6ba9d0a4 authored by Danijel Schorlemmer's avatar 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
......@@ -641,7 +641,7 @@ class JapanDatabase(SpatialiteDatabase):
File path to the boundary file
"""
# Attach geopackage boundary database to the Japan database
# Attach Geopackage 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(GeomFromWKB(AsBinary(geom), %d)), "
"%d) " % (constants.JGD2000, constants.WGS84)
"ST_Transform(CastToMultiPolygon(GeomFromGPB(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 geopackage boundary database from the Japan database
# Detach Geopackage boundary database from the Japan database
sql_statement = "DETACH DATABASE 'BoundaryDatabase'"
logger.debug(sql_statement)
self.connection.execute(sql_statement)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment