diff --git a/exposurejapan/database.py b/exposurejapan/database.py index f153948a48243f69b593f96b6dad2344f8ab1e7d..765c6dbfa410dc9b786540d68934a3db5f9e0a2c 100644 --- a/exposurejapan/database.py +++ b/exposurejapan/database.py @@ -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" self.cursor.execute(sql_statement) 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