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
|
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._name = name
|
||||||
|
self._centroid = centroid
|
||||||
self._total_floor_area = total_floor_area
|
self._total_floor_area = total_floor_area
|
||||||
self._year_of_construction = year_of_construction
|
self._year_of_construction = year_of_construction
|
||||||
self._function = function
|
self._function = function
|
||||||
|
@ -17,6 +18,10 @@ class SimplifiedBuilding:
|
||||||
def name(self):
|
def name(self):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def centroid(self):
|
||||||
|
return self._centroid
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def total_floor_area(self):
|
def total_floor_area(self):
|
||||||
return self._total_floor_area
|
return self._total_floor_area
|
||||||
|
|
|
@ -11,11 +11,13 @@ class Csv:
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
path,
|
path,
|
||||||
|
centroid=None,
|
||||||
year_of_construction_field=None,
|
year_of_construction_field=None,
|
||||||
function_field=None,
|
function_field=None,
|
||||||
function_to_hub=None,
|
function_to_hub=None,
|
||||||
total_floor_area_field=None):
|
total_floor_area_field=None):
|
||||||
self._simplified_city = None
|
self._simplified_city = None
|
||||||
|
self._centroid = centroid
|
||||||
self._year_of_construction_field = year_of_construction_field
|
self._year_of_construction_field = year_of_construction_field
|
||||||
self._function_field = function_field
|
self._function_field = function_field
|
||||||
self._function_to_hub = function_to_hub
|
self._function_to_hub = function_to_hub
|
||||||
|
@ -53,6 +55,10 @@ class Csv:
|
||||||
if self._simplified_city is None:
|
if self._simplified_city is None:
|
||||||
self._simplified_city = SimplifiedCity()
|
self._simplified_city = SimplifiedCity()
|
||||||
for row in self._csv_data:
|
for row in self._csv_data:
|
||||||
|
centroid = None
|
||||||
|
if self._centroid:
|
||||||
|
centroid = self.safe_int(row[self._centroid])
|
||||||
|
|
||||||
year_of_construction = None
|
year_of_construction = None
|
||||||
if self._year_of_construction_field:
|
if self._year_of_construction_field:
|
||||||
year_of_construction = self.safe_int(row[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(
|
building = SimplifiedBuilding(
|
||||||
name=building_name,
|
name=building_name,
|
||||||
|
centroid=centroid,
|
||||||
total_floor_area=total_floor_area,
|
total_floor_area=total_floor_area,
|
||||||
year_of_construction=year_of_construction,
|
year_of_construction=year_of_construction,
|
||||||
function=function
|
function=function
|
||||||
|
|
|
@ -22,6 +22,7 @@ class GeometryFactory:
|
||||||
path=None,
|
path=None,
|
||||||
aliases_field=None,
|
aliases_field=None,
|
||||||
height_field=None,
|
height_field=None,
|
||||||
|
centroid=None,
|
||||||
year_of_construction_field=None,
|
year_of_construction_field=None,
|
||||||
function_field=None,
|
function_field=None,
|
||||||
function_to_hub=None,
|
function_to_hub=None,
|
||||||
|
@ -32,6 +33,7 @@ class GeometryFactory:
|
||||||
self._path = path
|
self._path = path
|
||||||
self._aliases_field = aliases_field
|
self._aliases_field = aliases_field
|
||||||
self._height_field = height_field
|
self._height_field = height_field
|
||||||
|
self._centroid = centroid
|
||||||
self._year_of_construction_field = year_of_construction_field
|
self._year_of_construction_field = year_of_construction_field
|
||||||
self._function_field = function_field
|
self._function_field = function_field
|
||||||
self._function_to_hub = function_to_hub
|
self._function_to_hub = function_to_hub
|
||||||
|
@ -75,6 +77,7 @@ class GeometryFactory:
|
||||||
@property
|
@property
|
||||||
def _csv(self) -> SimplifiedCity:
|
def _csv(self) -> SimplifiedCity:
|
||||||
return Csv(self._path,
|
return Csv(self._path,
|
||||||
|
self._centroid,
|
||||||
self._year_of_construction_field,
|
self._year_of_construction_field,
|
||||||
self._function_field,
|
self._function_field,
|
||||||
self._function_to_hub,
|
self._function_to_hub,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user