Feature Request: Add input building usage to buildings class #74

Closed
opened 2024-11-05 13:05:13 -05:00 by k_wells · 1 comment
Owner

As part of the ABC Accelerator, we need to map the hub usages back to the Quebec codified usages. As such, it would be useful if the Buildings class had an attribute to record the original usage that is user provided. Otherwise, we end up having to select one codified usage for multiple hub usages (e.g. multiple codes refer to the warehouse usage)

As part of the ABC Accelerator, we need to map the hub usages back to the Quebec codified usages. As such, it would be useful if the Buildings class had an attribute to record the original usage that is user provided. Otherwise, we end up having to select one codified usage for multiple hub usages (e.g. multiple codes refer to the warehouse usage)
Owner

I understand your need, but such feature will only be for the ABC as is very specific, therefore I don't think it will be a that useful for other projects and may become burdensome for the maintenance of the hub.

I suggest you to use the alias field instead with it's supposed to be use as a mean to store non unique properties associated to the building

from pathlib import Path

from hub.helpers.dictionaries import Dictionaries
from hub.imports.geometry_factory import GeometryFactory

file_path = (Path(__file__).parent / 'input/test.geojson').resolve()

city = GeometryFactory('geojson',
                       path=file_path,
                       aliases_field=['CODE_UTILI'],
                       height_field='citygml_me',
                       year_of_construction_field='ANNEE_CONS',
                       function_field='CODE_UTILI',
                       function_to_hub=Dictionaries().montreal_function_to_hub_function).city

for building in city.buildings:
  print(building.name, building.aliases, building.function)

and as result you get

/home/guille/miniconda3/envs/aliasSample/bin/python /home/guille/Projects/Concordia/aliasSample/main.py
1 ['5010'] stand alone retail
2 ['1000'] residential
3 ['5010'] stand alone retail
4 ['5010'] stand alone retail
5 ['1000'] residential
6 ['1000'] residential
8 ['6000'] medium office
9 ['6000'] medium office
10 ['6000'] medium office
11 ['6000'] medium office
12 ['6000'] medium office
13 ['6000'] medium office
14 ['6000'] medium office
15 ['6000'] medium office
16 ['6000'] medium office
67 ['1921'] warehouse
68 ['1921'] warehouse

I understand your need, but such feature will only be for the ABC as is very specific, therefore I don't think it will be a that useful for other projects and may become burdensome for the maintenance of the hub. I suggest you to use the alias field instead with it's supposed to be use as a mean to store non unique properties associated to the building ``` from pathlib import Path from hub.helpers.dictionaries import Dictionaries from hub.imports.geometry_factory import GeometryFactory file_path = (Path(__file__).parent / 'input/test.geojson').resolve() city = GeometryFactory('geojson', path=file_path, aliases_field=['CODE_UTILI'], height_field='citygml_me', year_of_construction_field='ANNEE_CONS', function_field='CODE_UTILI', function_to_hub=Dictionaries().montreal_function_to_hub_function).city for building in city.buildings: print(building.name, building.aliases, building.function) ``` and as result you get > /home/guille/miniconda3/envs/aliasSample/bin/python /home/guille/Projects/Concordia/aliasSample/main.py > 1 ['5010'] stand alone retail > 2 ['1000'] residential > 3 ['5010'] stand alone retail > 4 ['5010'] stand alone retail > 5 ['1000'] residential > 6 ['1000'] residential > 8 ['6000'] medium office > 9 ['6000'] medium office > 10 ['6000'] medium office > 11 ['6000'] medium office > 12 ['6000'] medium office > 13 ['6000'] medium office > 14 ['6000'] medium office > 15 ['6000'] medium office > 16 ['6000'] medium office > 67 ['1921'] warehouse > 68 ['1921'] warehouse
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: CERC/hub#74
No description provided.