Merge pull request 'Remove usages_percentage in favor of usages' (#78) from fix/remove-usages_percentage into main

Reviewed-on: #78
This commit is contained in:
Guille Gutierrez 2024-12-04 00:11:05 -05:00
commit 766eba2cb7
3 changed files with 7 additions and 6 deletions

View File

@ -169,7 +169,7 @@ class EnergyAde:
def _building_geometry(self, building, building_dic, city):
building_dic['bldg:Building']['bldg:function'] = building.function
building_dic['bldg:Building']['bldg:usage'] = building.usages_percentage
building_dic['bldg:Building']['bldg:usage'] = building.usages
building_dic['bldg:Building']['bldg:yearOfConstruction'] = building.year_of_construction
building_dic['bldg:Building']['bldg:roofType'] = building.roof_type
building_dic['bldg:Building']['bldg:measuredHeight'] = {

View File

@ -77,8 +77,8 @@ class CesiumjsTileset:
'function': {
'type': 'STRING'
},
'usages_percentage': {
'type': 'STRING'
'usages': {
'type': 'LIST'
}
}
}
@ -146,7 +146,7 @@ class CesiumjsTileset:
'max_height': building.max_height,
'year_of_construction': building.year_of_construction,
'function': building.function,
'usages_percentage': building.usages
'usages': building.usages
}
},
'content': {

View File

@ -9,6 +9,7 @@ import datetime
import logging
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey, Float
from sqlalchemy.dialects.postgresql import JSON
from sqlalchemy import DateTime
from hub.city_model_structure.building import Building
@ -27,7 +28,7 @@ class CityObject(Models):
type = Column(String, nullable=False)
year_of_construction = Column(Integer, nullable=True)
function = Column(String, nullable=True)
usage = Column(String, nullable=True)
usage = Column(JSON, nullable=True)
volume = Column(Float, nullable=False)
area = Column(Float, nullable=False)
total_heating_area = Column(Float, nullable=False)
@ -46,7 +47,7 @@ class CityObject(Models):
self.type = building.type
self.year_of_construction = building.year_of_construction
self.function = building.function
self.usage = building.usages_percentage
self.usage = building.usages
self.volume = building.volume
self.area = building.floor_area
self.roof_area = sum(roof.solid_polygon.area for roof in building.roofs)