Commit bd4bfec8 authored by Simantini Shinde's avatar Simantini Shinde
Browse files

Removed calculate_district_area

parent 7ea49252
Pipeline #37850 passed with stage
in 1 minute and 37 seconds
......@@ -1026,41 +1026,6 @@ class JapanDatabase(SpatialiteDatabase):
return polygon.area
def calculate_district_area(self):
Selects all districts (i.e. administrative units) and their geometry from District
table and calculates the unit area for each district and stores it in a list.
List with districts, their geometries and their unit areas.
# Select the district_id and geometry from District table
sql_statement = "SELECT id, AsWKT(CastAutomagic(geom)) FROM District"
# Create an empty list to store the districts and their unit areas
districts = []
# Store all districts and their geometry in a list
for row in self.cursor:
add_element_and_get_index(row, districts)
# Calculate the district area and add it to the districts list.
for row in districts:
admin_unit_geom = shapely.wkt.loads(row[1])
administrative_unit_area = (
self.albers_area_calculation(admin_unit_geom, "epsg: %d")
% constants.JGD2000
* 0.000001
) #
# Convert to square kilometers
index = districts.index(row)
districts[index] = row + (administrative_unit_area,)
numpy.seterr(divide="ignore", invalid="ignore")
return districts
def import_population_distribution(self, population_distribution_filepath):
Imports all population data from the 2015 Population Census file provided
......@@ -1167,8 +1132,12 @@ class JapanDatabase(SpatialiteDatabase):
"6_150m2 and over",
# Select the district_id and area_size from District table
sql_statement = "SELECT id, area_size FROM District"
# Store all district (i.e. administrative unit) areas with their district_ids in a list
districts = self.calculate_district_area()
districts = self.cursor.fetchall()
# Import population data into the database
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