Commit d47e6da1 authored by Danijel Schorlemmer's avatar Danijel Schorlemmer
Browse files

Changed the Shapely polygon creation from WKT to WKB to speed up the processing

parent 7afb795e
Pipeline #37923 passed with stage
in 2 minutes and 4 seconds
......@@ -22,6 +22,7 @@ import pandas
import numpy
import constants
import shapely.wkt
import shapely.wkb
import pyproj
from shapely.ops import transform
import csv
......@@ -634,11 +635,11 @@ class JapanDatabase(SpatialiteDatabase):
# Calculate the area for each district using Albers equal area transformation
# and update the Districts table
sql_statement = "SELECT id, ST_AsText(geom) FROM District"
sql_statement = "SELECT id, AsBinary(geom) FROM District"
districts = self.cursor.fetchall()
for district in districts:
district_geom = shapely.wkt.loads(district[1])
district_geom = shapely.wkb.loads(district[1])
district_size = (
self.albers_area_calculation(district_geom, "epsg:%d" % constants.WGS84)
* 0.000001 # Convert from square meters to square kilometers
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