feat: add centroid to the attributes of the simplified building
This commit is contained in:
parent
7cc7221ab8
commit
f6955130be
@ -5,8 +5,9 @@ class SimplifiedBuilding:
|
||||
"""
|
||||
SimplifiedBuilding class
|
||||
"""
|
||||
def __init__(self, name, total_floor_area=None, year_of_construction=None, function=None, city=None):
|
||||
def __init__(self, name, centroid=None, total_floor_area=None, year_of_construction=None, function=None, city=None):
|
||||
self._name = name
|
||||
self._centroid = centroid
|
||||
self._total_floor_area = total_floor_area
|
||||
self._year_of_construction = year_of_construction
|
||||
self._function = function
|
||||
@ -17,6 +18,10 @@ class SimplifiedBuilding:
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def centroid(self):
|
||||
return self._centroid
|
||||
|
||||
@property
|
||||
def total_floor_area(self):
|
||||
return self._total_floor_area
|
||||
|
@ -11,11 +11,13 @@ class Csv:
|
||||
|
||||
def __init__(self,
|
||||
path,
|
||||
centroid=None,
|
||||
year_of_construction_field=None,
|
||||
function_field=None,
|
||||
function_to_hub=None,
|
||||
total_floor_area_field=None):
|
||||
self._simplified_city = None
|
||||
self._centroid = centroid
|
||||
self._year_of_construction_field = year_of_construction_field
|
||||
self._function_field = function_field
|
||||
self._function_to_hub = function_to_hub
|
||||
@ -53,6 +55,10 @@ class Csv:
|
||||
if self._simplified_city is None:
|
||||
self._simplified_city = SimplifiedCity()
|
||||
for row in self._csv_data:
|
||||
centroid = None
|
||||
if self._centroid:
|
||||
centroid = self.safe_int(row[self._centroid])
|
||||
|
||||
year_of_construction = None
|
||||
if self._year_of_construction_field:
|
||||
year_of_construction = self.safe_int(row[self._year_of_construction_field])
|
||||
@ -74,6 +80,7 @@ class Csv:
|
||||
|
||||
building = SimplifiedBuilding(
|
||||
name=building_name,
|
||||
centroid=centroid,
|
||||
total_floor_area=total_floor_area,
|
||||
year_of_construction=year_of_construction,
|
||||
function=function
|
||||
|
@ -22,6 +22,7 @@ class GeometryFactory:
|
||||
path=None,
|
||||
aliases_field=None,
|
||||
height_field=None,
|
||||
centroid=None,
|
||||
year_of_construction_field=None,
|
||||
function_field=None,
|
||||
function_to_hub=None,
|
||||
@ -32,6 +33,7 @@ class GeometryFactory:
|
||||
self._path = path
|
||||
self._aliases_field = aliases_field
|
||||
self._height_field = height_field
|
||||
self._centroid = centroid
|
||||
self._year_of_construction_field = year_of_construction_field
|
||||
self._function_field = function_field
|
||||
self._function_to_hub = function_to_hub
|
||||
@ -75,6 +77,7 @@ class GeometryFactory:
|
||||
@property
|
||||
def _csv(self) -> SimplifiedCity:
|
||||
return Csv(self._path,
|
||||
self._centroid,
|
||||
self._year_of_construction_field,
|
||||
self._function_field,
|
||||
self._function_to_hub,
|
||||
|
Loading…
Reference in New Issue
Block a user