diff --git a/.gitignore b/.gitignore index bfd8699..8b315b2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ # Ignore files that start with 'building' in the 'input_files' directory input_files/* +!input_files/merged-network.osm.pbf +!input_files/summerschool_all_buildings.geojson + # Ignore all files inside the 'output_files' directory output_files/* output/* \ No newline at end of file diff --git a/__pycache__/hub_function_to_matsim_activity.cpython-39.pyc b/__pycache__/hub_function_to_matsim_activity.cpython-39.pyc deleted file mode 100644 index 2efa0e6..0000000 Binary files a/__pycache__/hub_function_to_matsim_activity.cpython-39.pyc and /dev/null differ diff --git a/__pycache__/matsim.cpython-39.pyc b/__pycache__/matsim.cpython-39.pyc index e527997..625f92b 100644 Binary files a/__pycache__/matsim.cpython-39.pyc and b/__pycache__/matsim.cpython-39.pyc differ diff --git a/__pycache__/matsim_activity_to_matsim_schedule.cpython-39.pyc b/__pycache__/matsim_activity_to_matsim_schedule.cpython-39.pyc deleted file mode 100644 index 735665f..0000000 Binary files a/__pycache__/matsim_activity_to_matsim_schedule.cpython-39.pyc and /dev/null differ diff --git a/__pycache__/matsim_engine.cpython-39.pyc b/__pycache__/matsim_engine.cpython-39.pyc index 2fc4117..bdf04f8 100644 Binary files a/__pycache__/matsim_engine.cpython-39.pyc and b/__pycache__/matsim_engine.cpython-39.pyc differ diff --git a/__pycache__/matsim_visualizer.cpython-39.pyc b/__pycache__/matsim_visualizer.cpython-39.pyc index b135925..3c2c327 100644 Binary files a/__pycache__/matsim_visualizer.cpython-39.pyc and b/__pycache__/matsim_visualizer.cpython-39.pyc differ diff --git a/hub_function_to_matsim_activity.py b/hub_function_to_matsim_activity.py deleted file mode 100644 index be667f5..0000000 --- a/hub_function_to_matsim_activity.py +++ /dev/null @@ -1,78 +0,0 @@ -import hub.helpers.constants as cte - -class HubFunctionToMatsimActivity: - """ - Hub function to matsim activity construction function class - """ - def __init__(self): - self._dictionary = { - cte.RESIDENTIAL: 'home', - cte.SINGLE_FAMILY_HOUSE: 'home', - cte.MULTI_FAMILY_HOUSE: 'home', - cte.ROW_HOUSE: 'home', - cte.MID_RISE_APARTMENT: 'home', - cte.HIGH_RISE_APARTMENT: 'home', - cte.OFFICE_AND_ADMINISTRATION: 'work', - cte.SMALL_OFFICE: 'work', - cte.MEDIUM_OFFICE: 'work', - cte.LARGE_OFFICE: 'work', - cte.COURTHOUSE: 'work', - cte.FIRE_STATION: 'work', - cte.PENITENTIARY: 'work', - cte.POLICE_STATION: 'work', - cte.POST_OFFICE: 'work', - cte.LIBRARY: 'edu', - cte.EDUCATION: 'edu', - cte.PRIMARY_SCHOOL: 'edu', - cte.PRIMARY_SCHOOL_WITH_SHOWER: 'edu', - cte.SECONDARY_SCHOOL: 'edu', - cte.UNIVERSITY: 'edu', - cte.LABORATORY_AND_RESEARCH_CENTER: 'edu', - cte.STAND_ALONE_RETAIL: 'work,secondary', - cte.HOSPITAL: 'work', - cte.OUT_PATIENT_HEALTH_CARE: 'work', - cte.HEALTH_CARE: 'work', - cte.RETIREMENT_HOME_OR_ORPHANAGE: 'home,secondary', - cte.COMMERCIAL: 'work,secondary', - cte.STRIP_MALL: 'work,secondary', - cte.SUPERMARKET: 'work,secondary', - cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'work,secondary', - cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'work,secondary', - cte.RESTAURANT: 'work,secondary', - cte.QUICK_SERVICE_RESTAURANT: 'work,secondary', - cte.FULL_SERVICE_RESTAURANT: 'work,secondary', - cte.HOTEL: 'work,secondary', - cte.HOTEL_MEDIUM_CLASS: 'work,secondary', - cte.SMALL_HOTEL: 'work,secondary', - cte.LARGE_HOTEL: 'work,secondary', - cte.DORMITORY: 'work', - cte.EVENT_LOCATION: 'work,secondary', - cte.CONVENTION_CENTER: 'work,secondary', - cte.HALL: 'work', - cte.GREEN_HOUSE: 'work', - cte.INDUSTRY: 'work', - cte.WORKSHOP: 'work', - cte.WAREHOUSE: 'work', - cte.WAREHOUSE_REFRIGERATED: 'work', - cte.SPORTS_LOCATION: 'work,secondary', - cte.SPORTS_ARENA: 'work,secondary', - cte.GYMNASIUM: 'work,secondary', - cte.MOTION_PICTURE_THEATRE: 'work,secondary', - cte.MUSEUM: 'work,secondary', - cte.PERFORMING_ARTS_THEATRE: 'work,secondary', - cte.TRANSPORTATION: 'work', - cte.AUTOMOTIVE_FACILITY: 'work', - cte.PARKING_GARAGE: 'work', - cte.RELIGIOUS: 'work,secondary', - cte.NON_HEATED: 'work', - cte.DATACENTER: 'work', - cte.FARM: 'work' - } - - @property - def dictionary(self) -> dict: - """ - Get the dictionary - :return: {} - """ - return self._dictionary diff --git a/input_files/merged-network.osm.pbf b/input_files/merged-network.osm.pbf new file mode 100644 index 0000000..4f19c13 Binary files /dev/null and b/input_files/merged-network.osm.pbf differ diff --git a/input_files/summerschool_all_buildings.geojson b/input_files/summerschool_all_buildings.geojson new file mode 100644 index 0000000..c1783e0 --- /dev/null +++ b/input_files/summerschool_all_buildings.geojson @@ -0,0 +1,2473 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "id": 3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.58027133757318, + 45.49778253958501 + ], + [ + -73.58029012091339, + 45.4977913628521 + ], + [ + -73.58030531916779, + 45.497798505928216 + ], + [ + -73.58031919454406, + 45.49778416165715 + ], + [ + -73.58032294575167, + 45.49778028519085 + ], + [ + -73.5803239370267, + 45.49778092788226 + ], + [ + -73.58032868649482, + 45.49778260725071 + ], + [ + -73.58035123655425, + 45.497758871501716 + ], + [ + -73.58034693486053, + 45.49775714682708 + ], + [ + -73.58034559351022, + 45.4977568679191 + ], + [ + -73.58034881064437, + 45.49775353713306 + ], + [ + -73.5803511232103, + 45.49775115091962 + ], + [ + -73.58034376740876, + 45.497747727688 + ], + [ + -73.58033641160816, + 45.49774430445582 + ], + [ + -73.58023858400132, + 45.49769876012238 + ], + [ + -73.5801407565522, + 45.49765321570472 + ], + [ + -73.58012849724439, + 45.49766577712958 + ], + [ + -73.58011623793112, + 45.4976783385531 + ], + [ + -73.58012118770385, + 45.49769495520085 + ], + [ + -73.58011416146232, + 45.49770285176125 + ], + [ + -73.58011049504559, + 45.49770697561838 + ], + [ + -73.58018191512001, + 45.49774053018273 + ], + [ + -73.58025333527925, + 45.497774084702165 + ], + [ + -73.58026233642553, + 45.497778312143936 + ], + [ + -73.58027133757318, + 45.49778253958501 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 3, + "gml_id": 1340910, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 21.916, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": 2257.436, + "parcelle": " ", + "OBJECTID": 780, + "gml_id_1": "8222a1c7-e161-421a-8478-22d2a116e0b4", + "gml_pare_1": 1340910, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 144.697, + "FID_": 0, + "Join_Count": 2, + "TARGET_FID": 781, + "gml_id_12": 1340910, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 21.916, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": 2257.436, + "Field": 0, + "Field1": 0, + "OBJECTID_1": 780, + "gml_id_12_": "8222a1c7-e161-421a-8478-22d2a116e0b4", + "gml_pare_3": 1340910, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 144.697, + "cityGML_hi": 0, + "Z_Min": 48.9834, + "Z_Max": 67.617, + "Shape_Leng": 52.2836566341, + "ID_UEV": "01002775", + "CIVIQUE_DE": " 1448", + "CIVIQUE_FI": " 1448", + "NOM_RUE": "rue Sherbrooke Ouest (MTL+MTO+WMT)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1885, + "CODE_UTILI": 5010, + "LIBELLE_UT": "Immeuble commercial", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-3057-9-000-0000", + "SUPERFICIE": 167, + "SUPERFIC_1": 354, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.00074417728925, + "Shape_Ar_1": 1.92186900974e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 52.28365663409477, + "Shape_Area": 123.24449716965384 + } + }, + { + "type": "Feature", + "id": 5, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.57987280223287, + 45.49780197663469 + ], + [ + -73.57989410857009, + 45.497812471912496 + ], + [ + -73.5799154149152, + 45.4978229671863 + ], + [ + -73.57991587587279, + 45.49782319632402 + ], + [ + -73.57991633683041, + 45.497823425461746 + ], + [ + -73.57994396849938, + 45.497837029765 + ], + [ + -73.57994983287693, + 45.49783992315832 + ], + [ + -73.57995569725507, + 45.49784281655128 + ], + [ + -73.57999583877229, + 45.49786259401303 + ], + [ + -73.58000874551566, + 45.49786894687061 + ], + [ + -73.58001902738776, + 45.49787401478859 + ], + [ + -73.5801510016764, + 45.49793903497323 + ], + [ + -73.58015255099711, + 45.497939794254236 + ], + [ + -73.58015410031787, + 45.497940553535265 + ], + [ + -73.58015964461515, + 45.49794329416885 + ], + [ + -73.580163524261, + 45.49794515412329 + ], + [ + -73.58021253545378, + 45.49789446749787 + ], + [ + -73.58020911673718, + 45.49789281418553 + ], + [ + -73.58020029465442, + 45.49788854612092 + ], + [ + -73.58005728487048, + 45.497819331455986 + ], + [ + -73.58002896209338, + 45.497805628681455 + ], + [ + -73.58001106161767, + 45.497796768759315 + ], + [ + -73.5799931611476, + 45.49778790883436 + ], + [ + -73.57996464588562, + 45.49777379225035 + ], + [ + -73.57994337788503, + 45.49776326096506 + ], + [ + -73.5799221098924, + 45.49775272967573 + ], + [ + -73.57989400442865, + 45.4977388332491 + ], + [ + -73.57986589897874, + 45.4977249368155 + ], + [ + -73.57986299879909, + 45.497723499092736 + ], + [ + -73.57986009861956, + 45.49772206136999 + ], + [ + -73.57980521410511, + 45.497772688960225 + ], + [ + -73.57981413841381, + 45.49777689399493 + ], + [ + -73.57981665544915, + 45.4977743096838 + ], + [ + -73.57987280223287, + 45.49780197663469 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 5, + "gml_id": 1340975, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 26.973, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": 4615.644, + "parcelle": " ", + "OBJECTID": 783, + "gml_id_1": "5d841c7d-db0a-496c-aa5b-ff010accb222", + "gml_pare_1": 1340975, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": "233.090", + "FID_": 0, + "Join_Count": 2, + "TARGET_FID": 784, + "gml_id_12": 1340975, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 26.973, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": 4615.644, + "Field": 0, + "Field1": 0, + "OBJECTID_1": 783, + "gml_id_12_": "5d841c7d-db0a-496c-aa5b-ff010accb222", + "gml_pare_3": 1340975, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": "233.090", + "cityGML_hi": 0, + "Z_Min": 47.9028, + "Z_Max": 74.876, + "Shape_Leng": 81.7235184451, + "ID_UEV": "01002773", + "CIVIQUE_DE": " 1438", + "CIVIQUE_FI": " 1438", + "NOM_RUE": "rue Sherbrooke Ouest (MTL+MTO+WMT)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 2, + "ANNEE_CONS": 1885, + "CODE_UTILI": 1000, + "LIBELLE_UT": "Logement", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-4570-0-000-0000", + "SUPERFICIE": 249, + "SUPERFIC_1": 506, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.000997036390488, + "Shape_Ar_1": 2.85432763043e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 81.72351844511994, + "Shape_Area": 226.8688400309068 + } + }, + { + "type": "Feature", + "id": 6, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.58020029465442, + 45.49788854612092 + ], + [ + -73.58020470569565, + 45.497890680153304 + ], + [ + -73.58020911673718, + 45.49789281418553 + ], + [ + -73.58021253545378, + 45.49789446749787 + ], + [ + -73.58022877454545, + 45.4978776740024 + ], + [ + -73.580230355015, + 45.49787604057531 + ], + [ + -73.58023193420492, + 45.49787440714907 + ], + [ + -73.58023292932299, + 45.49787505253807 + ], + [ + -73.58023531045096, + 45.49787588772046 + ], + [ + -73.58023769157896, + 45.497876722902824 + ], + [ + -73.58026022893152, + 45.497852996179574 + ], + [ + -73.58025592722062, + 45.49785126250309 + ], + [ + -73.58025458714808, + 45.49785098359313 + ], + [ + -73.5802576496991, + 45.497847814890285 + ], + [ + -73.58025809687858, + 45.497847351156395 + ], + [ + -73.58025854405807, + 45.49784688742253 + ], + [ + -73.58027411873532, + 45.49783077826882 + ], + [ + -73.58027633675611, + 45.49782848660698 + ], + [ + -73.58027683239438, + 45.49782880840284 + ], + [ + -73.58027732803141, + 45.49782912929881 + ], + [ + -73.58028209028483, + 45.497830799661735 + ], + [ + -73.58029335894497, + 45.497818936296206 + ], + [ + -73.58030462760044, + 45.49780707292953 + ], + [ + -73.58030033869983, + 45.49780534824416 + ], + [ + -73.58029965906428, + 45.4978052065466 + ], + [ + -73.58029897814917, + 45.49780506484989 + ], + [ + -73.58030104413092, + 45.4978029334667 + ], + [ + -73.58030310883294, + 45.49780080208443 + ], + [ + -73.58030421400039, + 45.49779965400631 + ], + [ + -73.58030531916779, + 45.497798505928216 + ], + [ + -73.58029012091339, + 45.4977913628521 + ], + [ + -73.58027133757318, + 45.49778253958501 + ], + [ + -73.58026233642553, + 45.497778312143936 + ], + [ + -73.58025333527925, + 45.497774084702165 + ], + [ + -73.58018191512001, + 45.49774053018273 + ], + [ + -73.58011049504559, + 45.49770697561838 + ], + [ + -73.58005920141883, + 45.49768195092396 + ], + [ + -73.58001546938262, + 45.497728845444165 + ], + [ + -73.5800114873555, + 45.49772695856106 + ], + [ + -73.57996464588562, + 45.49777379225035 + ], + [ + -73.5799931611476, + 45.49778790883436 + ], + [ + -73.58002896209338, + 45.497805628681455 + ], + [ + -73.58005728487048, + 45.497819331455986 + ], + [ + -73.58020029465442, + 45.49788854612092 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 6, + "gml_id": 1340973, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 22.324, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": "5526.970", + "parcelle": " ", + "OBJECTID": 784, + "gml_id_1": "cee7bddb-ab30-4184-aaad-071dc8a493dd", + "gml_pare_1": 1340973, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 344.679, + "FID_": 0, + "Join_Count": 2, + "TARGET_FID": 785, + "gml_id_12": 1340973, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 22.324, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": "5526.970", + "Field": 0, + "Field1": 0, + "OBJECTID_1": 784, + "gml_id_12_": "cee7bddb-ab30-4184-aaad-071dc8a493dd", + "gml_pare_3": 1340973, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 344.679, + "cityGML_hi": 0, + "Z_Min": 48.5686, + "Z_Max": 68.604, + "Shape_Leng": 74.7024378907, + "ID_UEV": "01002773", + "CIVIQUE_DE": " 1438", + "CIVIQUE_FI": " 1438", + "NOM_RUE": "rue Sherbrooke Ouest (MTL+MTO+WMT)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 2, + "ANNEE_CONS": 1885, + "CODE_UTILI": 1000, + "LIBELLE_UT": "Logement", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-4570-0-000-0000", + "SUPERFICIE": 249, + "SUPERFIC_1": 506, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.000997036390488, + "Shape_Ar_1": 2.85432763043e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 74.70243789066224, + "Shape_Area": 300.3128592870276 + } + }, + { + "type": "Feature", + "id": 8, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.57951109372742, + 45.49797740161985 + ], + [ + -73.5795154252114, + 45.49797302536288 + ], + [ + -73.57952250596712, + 45.497976502829886 + ], + [ + -73.5795258025052, + 45.49797318011049 + ], + [ + -73.57952723636215, + 45.49797372801708 + ], + [ + -73.5795289514519, + 45.497974086760586 + ], + [ + -73.57953069177773, + 45.49797419353016 + ], + [ + -73.57953223985594, + 45.49797407547255 + ], + [ + -73.57953359578782, + 45.497973804575274 + ], + [ + -73.57953408818886, + 45.49797364675974 + ], + [ + -73.57953458058988, + 45.49797348894419 + ], + [ + -73.57953564193629, + 45.497973011287854 + ], + [ + -73.57953672859472, + 45.49797233564821 + ], + [ + -73.57953788096579, + 45.49797289274911 + ], + [ + -73.57970940276014, + 45.4978001291146 + ], + [ + -73.57975656339444, + 45.49775262042428 + ], + [ + -73.57968090322977, + 45.49771547367498 + ], + [ + -73.57963739684415, + 45.497759299424665 + ], + [ + -73.57963374256275, + 45.49776298233438 + ], + [ + -73.57952818975889, + 45.49786930045622 + ], + [ + -73.57952481016481, + 45.49787269972034 + ], + [ + -73.57952143057031, + 45.497876098984314 + ], + [ + -73.57950823165471, + 45.49788939886833 + ], + [ + -73.57949503273288, + 45.49790269875081 + ], + [ + -73.5794800321942, + 45.497917804072586 + ], + [ + -73.57946503164756, + 45.497932909392325 + ], + [ + -73.57946222064952, + 45.49793574585649 + ], + [ + -73.57948812364579, + 45.49794846962509 + ], + [ + -73.57948731962531, + 45.4979499549272 + ], + [ + -73.5794871296316, + 45.49795133182075 + ], + [ + -73.57948733601646, + 45.49795251047276 + ], + [ + -73.5794878108513, + 45.49795350896919 + ], + [ + -73.57948816335764, + 45.49795395864589 + ], + [ + -73.57948851586393, + 45.4979544083226 + ], + [ + -73.57948946386242, + 45.4979552175225 + ], + [ + -73.57949047539473, + 45.4979557117328 + ], + [ + -73.57948878239833, + 45.49795741361608 + ], + [ + -73.57948708940182, + 45.497959115499384 + ], + [ + -73.57949283850887, + 45.49796193700876 + ], + [ + -73.57949067276019, + 45.49796412063761 + ], + [ + -73.57948850701138, + 45.497966304266455 + ], + [ + -73.57951109372742, + 45.49797740161985 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 8, + "gml_id": 1340981, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 19.833, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": "3138.930", + "parcelle": " ", + "OBJECTID": 1050, + "gml_id_1": "b2437d15-0f9d-4af9-8ae5-dd5d201128a7", + "gml_pare_1": 1340981, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 221.093, + "FID_": 0, + "Join_Count": 1, + "TARGET_FID": 1052, + "gml_id_12": 1340981, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 19.833, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": "3138.930", + "Field": 0, + "Field1": 0, + "OBJECTID_1": 1050, + "gml_id_12_": "b2437d15-0f9d-4af9-8ae5-dd5d201128a7", + "gml_pare_3": 1340981, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 221.093, + "cityGML_hi": 0, + "Z_Min": 46.3931, + "Z_Max": 66.226, + "Shape_Leng": 76.8106772684, + "ID_UEV": "01036804", + "CIVIQUE_DE": " 2170", + "CIVIQUE_FI": " 2170", + "NOM_RUE": "rue Bishop (MTL)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1900, + "CODE_UTILI": 6000, + "LIBELLE_UT": "Immeuble à bureaux", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-7770-3-000-0000", + "SUPERFICIE": 259, + "SUPERFIC_1": 490, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.00093336765858, + "Shape_Ar_1": 3.0845126501e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 76.81067726839883, + "Shape_Area": 220.5412075100958 + } + }, + { + "type": "Feature", + "id": 9, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.57938148575774, + 45.49789949328572 + ], + [ + -73.57938505429556, + 45.49790124550157 + ], + [ + -73.57938759058709, + 45.49789868818189 + ], + [ + -73.57939012687844, + 45.49789613086214 + ], + [ + -73.5795114087957, + 45.497773973664174 + ], + [ + -73.57955974509859, + 45.4977252944393 + ], + [ + -73.57956286932851, + 45.49772683099649 + ], + [ + -73.57956562282082, + 45.49772405755894 + ], + [ + -73.57964521844113, + 45.497643888972846 + ], + [ + -73.57956635744928, + 45.497605169651614 + ], + [ + -73.57948122283224, + 45.49769091207221 + ], + [ + -73.57953219634075, + 45.497715946247425 + ], + [ + -73.57950942730618, + 45.49773888112614 + ], + [ + -73.57948665825312, + 45.49776181600022 + ], + [ + -73.57946779765572, + 45.49775255173118 + ], + [ + -73.5794529249259, + 45.49776753098267 + ], + [ + -73.5794380521882, + 45.49778251023223 + ], + [ + -73.5794031991453, + 45.49776539243639 + ], + [ + -73.57935742452761, + 45.49781149626111 + ], + [ + -73.57931164983522, + 45.49785760006716 + ], + [ + -73.57931042303355, + 45.497858707727076 + ], + [ + -73.5793091962319, + 45.49785981538704 + ], + [ + -73.5793064876179, + 45.49786266977316 + ], + [ + -73.5793241663915, + 45.497871349990795 + ], + [ + -73.57932313525795, + 45.497872385527465 + ], + [ + -73.5793365732836, + 45.497878985549114 + ], + [ + -73.57935001131231, + 45.49788558556917 + ], + [ + -73.57936344933792, + 45.497892181088396 + ], + [ + -73.57937688736664, + 45.4978987766061 + ], + [ + -73.57937740229337, + 45.49789825883794 + ], + [ + -73.57937791722013, + 45.4978977410698 + ], + [ + -73.57938148575774, + 45.49789949328572 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 9, + "gml_id": 1340983, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 19.431, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": 3266.741, + "parcelle": " ", + "OBJECTID": 1052, + "gml_id_1": "7e974d1b-2927-4864-a418-1c7293308ab5", + "gml_pare_1": 1340983, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 228.251, + "FID_": 0, + "Join_Count": 2, + "TARGET_FID": 1054, + "gml_id_12": 1340983, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 19.431, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": 3266.741, + "Field": 0, + "Field1": 0, + "OBJECTID_1": 1052, + "gml_id_12_": "7e974d1b-2927-4864-a418-1c7293308ab5", + "gml_pare_3": 1340983, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 228.251, + "cityGML_hi": 0, + "Z_Min": 45.7957, + "Z_Max": 63.513, + "Shape_Leng": 95.7443169372, + "ID_UEV": "01036800", + "CIVIQUE_DE": " 2150", + "CIVIQUE_FI": " 2150", + "NOM_RUE": "rue Bishop (MTL)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1900, + "CODE_UTILI": 6000, + "LIBELLE_UT": "Immeuble à bureaux", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-8961-7-000-0000", + "SUPERFICIE": 280, + "SUPERFIC_1": 665, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.000986139567008, + "Shape_Ar_1": 3.23120258539e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 95.74431693720996, + "Shape_Area": 218.19171039698008 + } + }, + { + "type": "Feature", + "id": 12, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.57945149010348, + 45.49793915473101 + ], + [ + -73.57945502047383, + 45.497935600591106 + ], + [ + -73.57945748913181, + 45.49793681276347 + ], + [ + -73.57945995778985, + 45.49793802493576 + ], + [ + -73.57946108986009, + 45.49793688584562 + ], + [ + -73.57946222064952, + 45.49793574585649 + ], + [ + -73.57946503164756, + 45.497932909392325 + ], + [ + -73.5794800321942, + 45.497917804072586 + ], + [ + -73.57949503273288, + 45.49790269875081 + ], + [ + -73.57950823165471, + 45.49788939886833 + ], + [ + -73.57952143057031, + 45.497876098984314 + ], + [ + -73.57952481016481, + 45.49787269972034 + ], + [ + -73.57952818975889, + 45.49786930045622 + ], + [ + -73.57963374256275, + 45.49776298233438 + ], + [ + -73.57963739684415, + 45.497759299424665 + ], + [ + -73.57956562282082, + 45.49772405755894 + ], + [ + -73.5795624921933, + 45.497722521006246 + ], + [ + -73.57955974509859, + 45.4977252944393 + ], + [ + -73.57953557695755, + 45.497749634054365 + ], + [ + -73.5795114087957, + 45.497773973664174 + ], + [ + -73.57945076790263, + 45.49783505227953 + ], + [ + -73.57939012687844, + 45.49789613086214 + ], + [ + -73.57938759058709, + 45.49789868818189 + ], + [ + -73.57938505429556, + 45.49790124550157 + ], + [ + -73.57941717242674, + 45.49791701633786 + ], + [ + -73.5794136407655, + 45.497920563278754 + ], + [ + -73.57943256542505, + 45.497929854507255 + ], + [ + -73.57944202776348, + 45.49793450461953 + ], + [ + -73.57945149010348, + 45.49793915473101 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 12, + "gml_id": 1340982, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 19.113, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": "2931.350", + "parcelle": " ", + "OBJECTID": 1056, + "gml_id_1": "384b2b1c-2e25-4f6a-b082-d272dba3453f", + "gml_pare_1": 1340982, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 191.404, + "FID_": 0, + "Join_Count": 2, + "TARGET_FID": 1058, + "gml_id_12": 1340982, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 19.113, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": "2931.350", + "Field": 0, + "Field1": 0, + "OBJECTID_1": 1056, + "gml_id_12_": "384b2b1c-2e25-4f6a-b082-d272dba3453f", + "gml_pare_3": 1340982, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 191.404, + "cityGML_hi": 0, + "Z_Min": 46.1162, + "Z_Max": 64.399, + "Shape_Leng": 63.6906066955, + "ID_UEV": "01036804", + "CIVIQUE_DE": " 2170", + "CIVIQUE_FI": " 2170", + "NOM_RUE": "rue Bishop (MTL)", + "MUNICIPALI": 50, + "ETAGE_HORS": 3, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1900, + "CODE_UTILI": 6000, + "LIBELLE_UT": "Immeuble à bureaux", + "CATEGORIE_": "Régulier", + "MATRICULE8": "9839-57-7770-3-000-0000", + "SUPERFICIE": 259, + "SUPERFIC_1": 490, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.00093336765858, + "Shape_Ar_1": 3.0845126501e-8, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 63.69060669550123, + "Shape_Area": 174.69050030775531 + } + }, + { + "type": "Feature", + "id": 67, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.58010292891963, + 45.49799287036775 + ], + [ + -73.58011273680593, + 45.49799752468131 + ], + [ + -73.58012031084986, + 45.49798971412218 + ], + [ + -73.58012467974646, + 45.49799190127798 + ], + [ + -73.58013996111403, + 45.49797643123792 + ], + [ + -73.58013533883219, + 45.49797421816498 + ], + [ + -73.580163524261, + 45.49794515412329 + ], + [ + -73.58015964461515, + 45.49794329416885 + ], + [ + -73.58015410031787, + 45.497940553535265 + ], + [ + -73.58015255099711, + 45.497939794254236 + ], + [ + -73.5801510016764, + 45.49793903497323 + ], + [ + -73.58001902738776, + 45.49787401478859 + ], + [ + -73.58001388645148, + 45.49787148082968 + ], + [ + -73.58000874551566, + 45.49786894687061 + ], + [ + -73.58000229214359, + 45.49786577044202 + ], + [ + -73.57999583877229, + 45.49786259401303 + ], + [ + -73.57995569725507, + 45.49784281655128 + ], + [ + -73.57994983287693, + 45.49783992315832 + ], + [ + -73.57994396849938, + 45.497837029765 + ], + [ + -73.57991633683041, + 45.497823425461746 + ], + [ + -73.57991587587279, + 45.49782319632402 + ], + [ + -73.5799154149152, + 45.4978229671863 + ], + [ + -73.57987280223287, + 45.49780197663469 + ], + [ + -73.57981665544915, + 45.4977743096838 + ], + [ + -73.57981413841381, + 45.49777689399493 + ], + [ + -73.57978767638981, + 45.4978032149227 + ], + [ + -73.5797612143412, + 45.49782953584428 + ], + [ + -73.57976492760102, + 45.4978313779316 + ], + [ + -73.5798290710499, + 45.49786323259251 + ], + [ + -73.57989321457111, + 45.49789508721708 + ], + [ + -73.57992789525107, + 45.49791230846571 + ], + [ + -73.57996257595215, + 45.49792952970371 + ], + [ + -73.57996346391319, + 45.497928597743545 + ], + [ + -73.57996435187418, + 45.49792766578335 + ], + [ + -73.58010292891963, + 45.49799287036775 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 67, + "gml_id": 1340976, + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 19.382, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": 4651.759, + "parcelle": " ", + "OBJECTID": 1286, + "gml_id_1": "e517a034-8126-49b9-89d2-29935510f1b5", + "gml_pare_1": 1340976, + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 259.608, + "FID_": 0, + "Join_Count": 70, + "TARGET_FID": 1288, + "gml_id_12": 1340976, + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 19.382, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": 4651.759, + "Field": 0, + "Field1": 0, + "OBJECTID_1": 1286, + "gml_id_12_": "e517a034-8126-49b9-89d2-29935510f1b5", + "gml_pare_3": 1340976, + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 259.608, + "cityGML_hi": 0, + "Z_Min": 47.8483, + "Z_Max": 67.23, + "Shape_Leng": 81.988433275, + "ID_UEV": "05240505", + "CIVIQUE_DE": " 1420", + "CIVIQUE_FI": " 1420", + "NOM_RUE": "rue Sherbrooke Ouest (MTL+MTO+WMT)", + "MUNICIPALI": 50, + "ETAGE_HORS": 2, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1960, + "CODE_UTILI": 1921, + "LIBELLE_UT": "Stationnement intérieur (condo)", + "CATEGORIE_": "Condominium", + "MATRICULE8": "9839-57-5991-7-000-0059", + "SUPERFICIE": 2, + "SUPERFIC_1": 417, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.00140439072469, + "Shape_Ar_1": 1.1105277353e-7, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 81.98843327497843, + "Shape_Area": 246.09568398597227 + } + }, + { + "type": "Feature", + "id": 68, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.57964976661111, + 45.497942971460205 + ], + [ + -73.57962425755655, + 45.497969197201265 + ], + [ + -73.57962510262334, + 45.49796960154196 + ], + [ + -73.57962594769015, + 45.497970005882685 + ], + [ + -73.57956790220166, + 45.49802967899225 + ], + [ + -73.57980654544164, + 45.498144485574635 + ], + [ + -73.57981023943898, + 45.49814626288509 + ], + [ + -73.57980717928245, + 45.49814934428925 + ], + [ + -73.57993619589217, + 45.49821272007089 + ], + [ + -73.57999882994953, + 45.49814966014923 + ], + [ + -73.57999206284883, + 45.49814633636552 + ], + [ + -73.57998529575022, + 45.49814301348126 + ], + [ + -73.580065380923, + 45.498060681940416 + ], + [ + -73.58005612479505, + 45.49805622700149 + ], + [ + -73.58006709099395, + 45.49804485608538 + ], + [ + -73.58007240631309, + 45.49804312105965 + ], + [ + -73.58008211444711, + 45.498031560257076 + ], + [ + -73.58008148515943, + 45.49802992928109 + ], + [ + -73.58011273680593, + 45.49799752468131 + ], + [ + -73.58010292891963, + 45.49799287036775 + ], + [ + -73.57996435187418, + 45.49792766578335 + ], + [ + -73.57996346391319, + 45.497928597743545 + ], + [ + -73.57996257595215, + 45.49792952970371 + ], + [ + -73.57992789525107, + 45.49791230846571 + ], + [ + -73.57989321457111, + 45.49789508721708 + ], + [ + -73.57976492760102, + 45.4978313779316 + ], + [ + -73.5797077895784, + 45.49789013263914 + ], + [ + -73.57967978268813, + 45.49791892019202 + ], + [ + -73.579675275642, + 45.497916745713354 + ], + [ + -73.57964976661111, + 45.497942971460205 + ] + ] + ] + }, + "properties": { + "OBJECTID_12": 68, + "gml_id": "PC-35007", + "gml_parent": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_ta": "http://www.opengis.net/citygml/building/2.0", + "citygml_fe": "cityObjectMember", + "citygml__1": " ", + "citygml__2": " ", + "gml_descri": " ", + "gml_name": " ", + "citygml_cr": " ", + "citygml_te": " ", + "externalRe": " ", + "external_1": " ", + "external_2": " ", + "citygml_ge": " ", + "citygml_re": " ", + "citygml__3": " ", + "citygml_ap": " ", + "citygml_cl": " ", + "citygml__4": " ", + "citygml_fu": " ", + "citygml__5": " ", + "citygml_us": " ", + "citygml__6": " ", + "citygml_ye": " ", + "citygml__7": " ", + "citygml_ro": " ", + "citygml__8": " ", + "citygml_me": 48.094, + "citygml__9": "#m", + "citygml_st": " ", + "citygml_10": " ", + "citygml_11": " ", + "citygml_12": " ", + "citygml_13": " ", + "citygml_14": " ", + "citygml_ou": " ", + "citygml_in": " ", + "citygml_bo": " ", + "citygml_le": " ", + "citygml_15": " ", + "citygml_co": " ", + "citygml_ad": " ", + "Volume": 34105.224, + "parcelle": " ", + "OBJECTID": 1300, + "gml_id_1": "3b092f68-5bb3-47d8-8cba-6388c31001e0", + "gml_pare_1": "PC-35007", + "citygml_16": "http://www.opengis.net/citygml/building/2.0", + "citygml_17": "boundedBy", + "citygml_18": " ", + "citygml_19": " ", + "gml_desc_1": " ", + "gml_name_1": " ", + "citygml_20": " ", + "citygml_21": " ", + "external_3": " ", + "external_4": " ", + "external_5": " ", + "citygml_22": " ", + "citygml_23": " ", + "citygml_24": " ", + "citygml_25": " ", + "citygml_26": " ", + "citygml_op": " ", + "Area": 933.942, + "FID_": 0, + "Join_Count": 69, + "TARGET_FID": 1302, + "gml_id_12": "PC-35007", + "gml_pare_2": "fme-gen-5fa2a82b-c38e-4bf0-9e8f-10a47b9f64f7", + "citygml_27": "http://www.opengis.net/citygml/building/2.0", + "citygml_28": "cityObjectMember", + "citygml_29": " ", + "citygml_30": " ", + "gml_desc_2": " ", + "gml_name_2": " ", + "citygml_31": " ", + "citygml_32": " ", + "external_6": " ", + "external_7": " ", + "external_8": " ", + "citygml_33": " ", + "citygml_34": " ", + "citygml_35": " ", + "citygml_36": " ", + "citygml_37": " ", + "citygml_38": " ", + "citygml_39": " ", + "citygml_40": " ", + "citygml_41": " ", + "citygml_42": " ", + "citygml_43": " ", + "citygml_44": " ", + "citygml_45": " ", + "citygml_46": " ", + "citygml_47": 48.094, + "citygml_48": "#m", + "citygml_49": " ", + "citygml_50": " ", + "citygml_51": " ", + "citygml_52": " ", + "citygml_53": " ", + "citygml_54": " ", + "citygml_55": " ", + "citygml_56": " ", + "citygml_57": " ", + "citygml_58": " ", + "citygml_59": " ", + "citygml_60": " ", + "citygml_61": " ", + "Volume_1": 34105.224, + "Field": 0, + "Field1": 0, + "OBJECTID_1": 1300, + "gml_id_12_": "3b092f68-5bb3-47d8-8cba-6388c31001e0", + "gml_pare_3": "PC-35007", + "citygml_62": "http://www.opengis.net/citygml/building/2.0", + "citygml_63": "boundedBy", + "citygml_64": " ", + "citygml_65": " ", + "gml_desc_3": " ", + "gml_name_3": " ", + "citygml_66": " ", + "citygml_67": " ", + "external_9": " ", + "externa_10": " ", + "externa_11": " ", + "citygml_68": " ", + "citygml_69": " ", + "citygml_70": " ", + "citygml_71": " ", + "citygml_72": " ", + "citygml_73": " ", + "Area_1": 933.942, + "cityGML_hi": 0, + "Z_Min": 47.4968, + "Z_Max": 95.591, + "Shape_Leng": 126.06526888, + "ID_UEV": "05240505", + "CIVIQUE_DE": " 1420", + "CIVIQUE_FI": " 1420", + "NOM_RUE": "rue Sherbrooke Ouest (MTL+MTO+WMT)", + "MUNICIPALI": 50, + "ETAGE_HORS": 2, + "NOMBRE_LOG": 1, + "ANNEE_CONS": 1960, + "CODE_UTILI": 1921, + "LIBELLE_UT": "Stationnement intérieur (condo)", + "CATEGORIE_": "Condominium", + "MATRICULE8": "9839-57-5991-7-000-0059", + "SUPERFICIE": 2, + "SUPERFIC_1": 417, + "NO_ARROND_": "REM19", + "Shape_Le_1": 0.00140439072469, + "Shape_Ar_1": 1.1105277353e-7, + "Z_Min_1": null, + "Z_Max_1": null, + "Shape_Length": 126.0652688796645, + "Shape_Area": 920.1220129190524 + } + } + ] +} \ No newline at end of file diff --git a/main.py b/main.py index c26bfc8..8559450 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ from hub.helpers.dictionaries import Dictionaries from matsim_engine import MatSimEngine from matsim import Matsim +from matsim_visualizer import MatsimVisualizer try: file_path = (Path(__file__).parent / 'input_files' / 'summerschool_all_buildings.geojson') @@ -24,11 +25,11 @@ try: ConstructionFactory(construction_format, city).enrich() UsageFactory(usage_format, city).enrich() - # Matsim(city, 'output_files')._export() + Matsim(city, 'output_files')._export() MatSimEngine('output_files/Montreal_config.xml').run() - # visualizer = MatSimVisualizer('output_files/network.xml.gz', 'output_files/output_events.xml.gz') - # visualizer.visualize() + visualizer = MatsimVisualizer('output_files/Montreal/output_network.xml.gz', 'output_files/Montreal/output_events.xml.gz') + visualizer.visualize() except Exception as ex: print('error: ', ex) diff --git a/matsim.py b/matsim.py index c0864d3..2a6ac3b 100644 --- a/matsim.py +++ b/matsim.py @@ -13,7 +13,6 @@ FACILITIES_DTD = "http://www.matsim.org/files/dtd/facilities_v1.dtd" POPULATION_DTD = "http://www.matsim.org/files/dtd/population_v5.dtd" -# TODO: remove xmltodict completely and replace with lxml as it doesnt allow for repeated mixed ordered tags class Matsim: def __init__(self, city, output_file_path): self._city = city @@ -69,23 +68,23 @@ class Matsim: } facility_xml = etree.SubElement(facilities_xml, 'facility', { - 'id': facility['id'], - 'x': facility['x'], - 'y': facility['y'], + 'id': f"{facility['id']}", + 'x': f"{facility['x']}", + 'y': f"{facility['y']}", }) activity_xml = etree.SubElement(facility_xml, 'activity', { - 'type': activity_info['type'] + 'type': f"{activity_info['type']}" }) etree.SubElement(activity_xml, 'capacity', { - 'value': activity_info['capacity'] + 'value': f"{activity_info['capacity']}" }) etree.SubElement(activity_xml, 'opentime', { - 'day': activity_info['opentime'][0]['day'], - 'start_time': activity_info['opentime'][0]['start_time'], - 'end_time': activity_info['opentime'][0]['end_time'] + 'day': f"{activity_info['opentime'][0]['day']}", + 'start_time': f"{activity_info['opentime'][0]['start_time']}", + 'end_time': f"{activity_info['opentime'][0]['end_time']}" }) facility['activity'].append(activity_info) @@ -98,13 +97,13 @@ class Matsim: gdf.to_file("input_files/buildings_shapefile.shp") # Convert the Python dictionary to an XML string - xml_content = etree.tostring(facilities_xml, pretty_print=True, encoding='UTF-8', xml_declaration=True).decode('utf-8') + xml_content = etree.tostring(facilities_xml, pretty_print=True, encoding='UTF-8').decode('utf-8') # Write the XML to the file output_file = f"{self._output_file_path}/{self._city.name}_facilities.xml" with open(output_file, 'w') as file: - file.write("") - file.write(f"") + file.write("\n") + file.write(f"\n") file.write(xml_content) with open(output_file, 'rb') as f_in: @@ -145,8 +144,8 @@ class Matsim: current_work = 0 for facility in self._facilities['facility']: if facility['activity'][0]['type'] == cte.RESIDENTIAL: - max_capacity = int(facility['activity'][0]['capacity']['value']) - for _ in range(max_capacity): + max_capacity = int(facility['activity'][0]['capacity']) + for i in range(max_capacity): person = etree.SubElement(population, 'person', { 'id': str(id), 'sex': 'm', @@ -158,10 +157,10 @@ class Matsim: # Residential activity etree.SubElement(plan, 'act', { - 'type': facility['activity'][0]['type'], - 'facility': facility['id'], - 'x': facility['x'], - 'y': facility['y'], + 'type': f"{facility['activity'][0]['type']}", + 'facility': f"{facility['id']}", + 'x': f"{facility['x']}", + 'y': f"{facility['y']}", 'end_time': '7:30:00' }) @@ -170,12 +169,12 @@ class Matsim: # Work activity etree.SubElement(plan, 'act', { - 'type': work[current_work]['type'], - 'facility': work[current_work]['facility'], - 'x': work[current_work]['x'], - 'y': work[current_work]['y'], - 'start_time': work[current_work]['start_time'], - 'end_time': work[current_work]['end_time'], + 'type': f"{work[current_work]['type']}", + 'facility': f"{work[current_work]['facility']}", + 'x': f"{work[current_work]['x']}", + 'y': f"{work[current_work]['y']}", + 'start_time': f"{work[current_work]['start_time']}", + 'end_time': f"{work[current_work]['end_time']}", }) # Leg to home @@ -183,10 +182,10 @@ class Matsim: # Residential activity (return) etree.SubElement(plan, 'act', { - 'type': facility['activity'][0]['type'], - 'facility': facility['id'], - 'x': facility['x'], - 'y': facility['y'], + 'type': f"{facility['activity'][0]['type']}", + 'facility': f"{facility['id']}", + 'x': f"{facility['x']}", + 'y': f"{facility['y']}", }) work[current_work]['capacity'] -= 1 @@ -196,42 +195,235 @@ class Matsim: id += 1 # Convert the Python dictionary to an XML string - xml_content = etree.tostring(population, pretty_print=True, encoding='UTF-8', xml_declaration=True).decode('utf-8') + xml_content = etree.tostring(population, pretty_print=True, encoding='UTF-8').decode('utf-8') # Write the XML to the file output_file = f"{self._output_file_path}/{self._city.name}_population.xml" with open(output_file, 'w') as file: + file.write("\n") + file.write(f"\n") file.write(xml_content) with open(output_file, 'rb') as f_in: with gzip.open(output_file + '.gz', 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - # TODO: Reimplement this after figuring out what's wrong with other files def _export_config(self): - pass + root = etree.Element('config') + + # ======== NETWORK ========= # + network_path_module = etree.SubElement(root, 'module', { + 'name': 'network' + }) + _add_param(network_path_module, 'inputNetworkFile', f"{self._city.name}_network.xml.gz") + + # ======== POPULATION ========= # + population_path_module = etree.SubElement(root, 'module', { + 'name': 'plans' + }) + _add_param(population_path_module, 'inputPlansFile', f"{self._city.name}_population.xml.gz") + + # ======== FACILITIES ========= # + facilities_path_module = etree.SubElement(root, 'module', { + 'name': 'facilities' + }) + _add_param(facilities_path_module, 'inputFacilitiesFile', f"{self._city.name}_facilities.xml.gz") + _add_param(facilities_path_module, 'facilitiesSource', 'fromFile') + + # ======== CONTROLER ========= # + controler_module = etree.SubElement(root, 'module', { + 'name': 'controler' + }) + controler_params = [ + ('writeEventsInterval', '1000'), + ('writePlansInterval', '1000'), + ('eventsFileFormat', 'xml'), + ('outputDirectory', f"{self._output_file_path}/Montreal"), + ('firstIteration', '0'), + ('lastIteration', '10'), + ('mobsim', 'qsim'), + ] + for param in controler_params: + _add_param(controler_module, param[0], param[1]) + + # ======== QSIM ========= # + qsim_module = etree.SubElement(root, 'module', { + 'name': 'qsim' + }) + qsim_params = [ + ('startTime', '00:00:00'), + ('endTime', '30:00:00'), + ('flowCapacityFactor', '1.00'), + ('storageCapacityFactor', '1.00'), + ('numberOfThreads', '1'), + ('snapshotperiod', '00:00:01'), + ('removeStuckVehicles', 'false'), + ('stuckTime', '3600.0'), + ('timeStepSize', '00:00:01'), + ('trafficDynamics', 'queue'), + ] + for param in qsim_params: + _add_param(qsim_module, param[0], param[1]) + + # ======== SCORING ========= # + score_module = etree.SubElement(root, 'module', { + 'name': 'planCalcScore' + }) + _add_param(score_module, 'BrainExpBeta', '1.0') + _add_param(score_module, 'learningRate', '1.0') + + scoring_paramset = etree.SubElement(score_module, 'parameterset', { + 'type': 'scoringParameters' + }) + scoring_paramset_params = [ + ('earlyDeparture', '0.0'), + ('lateArrival', '0.0'), + ('marginalUtilityOfMoney', '0.062'), + ('performing', '0.96'), + ('utilityOfLineSwitch', '0.0'), + ('waitingPt', '-0.18'), + ] + for param in scoring_paramset_params: + _add_param(scoring_paramset, param[0], param[1]) + + mode_paramsets = [ + ("car", + [ + ("marginalUtilityOfTraveling_util_hr", "0.0"), + ("constant", "-0.562"), + ("monetaryDistanceRate", "-0.0004") + ]), + ("walk", + [ + ("marginalUtilityOfTraveling_util_hr", "-1.14"), + ("constant", "0.0"), + ("marginalUtilityOfDistance_util_m", "0.0") + ]) + ] + for mode, parameters in mode_paramsets: + _add_parameterset(scoring_paramset, "modeParams", [("mode", mode)] + parameters) + + activity_paramsets = [ + ('residential',[ + ('priority', '1'), + ('typicalDuration', '13:00:00'), + ('minimalDuration', '01:00:00'), + ]), + ('medium office',[ + ('priority', '1'), + ('typicalDuration', '09:00:00'), + ('minimalDuration', '08:00:00'), + ('openingTime', '08:00:00'), + ('earliestEndTime', '17:00:00'), + ('latestStartTime', '09:00:00'), + ('closingTime', '18:00:00'), + ]), + ('warehouse',[ + ('priority', '1'), + ('typicalDuration', '09:00:00'), + ('minimalDuration', '08:00:00'), + ('openingTime', '08:00:00'), + ('earliestEndTime', '17:00:00'), + ('latestStartTime', '09:00:00'), + ('closingTime', '18:00:00'), + ]), + ('stand alone retail',[ + ('priority', '1'), + ('typicalDuration', '09:00:00'), + ('minimalDuration', '08:00:00'), + ('openingTime', '08:00:00'), + ('earliestEndTime', '17:00:00'), + ('latestStartTime', '09:00:00'), + ('closingTime', '18:00:00'), + ]), + ] + for activity_type, parameters in activity_paramsets: + _add_parameterset(scoring_paramset, "activityParams", [("activityType", activity_type)] + parameters) + + # ======== STRATEGY ========= # + strategy_module = etree.SubElement(root, 'module', { + 'name': 'strategy' + }) + _add_param(strategy_module, 'maxAgentPlanMemorySize', '6') + + strategy_paramsets = [ + ("ChangeExpBeta",[ + ("weight", "0.7"), + ]), + ("ReRoute",[ + ("disableAfterIteration", "2900"), + ("weight", "0.01"), + ]), + ("SubtourModeChoice", [ + ("disableAfterIteration", "2900"), + ("weight", "0.01"), + ]), + ("TimeAllocationMutator", [ + ("disableAfterIteration", "2900"), + ("weight", "0.01"), + ]), + ] + for name, parameters in strategy_paramsets: + _add_parameterset(strategy_module, "strategysettings", [("strategyName", name)] + parameters) + + # ======== SUBTOUR MODE CHOICE ========= # + subtour_module = etree.SubElement(root, 'module', { + 'name': 'subtourModeChoice' + }) + # Defines the chain-based modes, seperated by commas + _add_param(subtour_module, 'chainBasedModes', 'car') + # Defines whether car availability must be considered or not. An agent has no car only if it has no license, or never access to a car + _add_param(subtour_module, 'considerCarAvailability', 'true') + # Defines all the modes available, including chain-based modes, seperated by commas + _add_param(subtour_module, 'modes', 'car,walk') + + xml_content = etree.tostring(root, pretty_print=True, encoding='UTF-8').decode('utf-8') + + # Write the XML to the file + output_file = f"{self._output_file_path}/{self._city.name}_config.xml" + with open(output_file, 'w') as file: + file.write("\n") + file.write(f"\n") + file.write(xml_content) + + +def _add_param(parent, name, value): + etree.SubElement(parent, "param", { + 'name': name, + 'value': value + }) + + +def _add_parameterset(parent, type, parameters): + parameterset = etree.SubElement(parent, "parameterset", { + 'type': type + }) + for name, value in parameters: + _add_param(parameterset, name, value) + def _convert_schedules(building_schedules): converted_schedules = [] - for schedule in building_schedules: - opening_hour = 0 - closing_hour = 0 + opening_hour = 0 + closing_hour = 0 + schedule = building_schedules[0] - for i, value in enumerate(schedule.values): - if value > 0: - opening_hour = i - break + for i, value in enumerate(schedule.values): + if value > 0: + opening_hour = i + break - for i, value in reversed(list(enumerate(schedule.values))): - if value > 0: - closing_hour = i - break + for i, value in reversed(list(enumerate(schedule.values))): + if value > 0: + closing_hour = i + break + + for day in schedule.day_types: + if day[0:3] != 'hol': + converted_schedules.append({ + 'day': day[0:3], + 'start_time': f"{opening_hour:02}:00:00", + 'end_time': f"{closing_hour:02}:00:00" + }) - for day in schedule.day_types: - if day[0:3] != 'hol': - converted_schedules.append({ - 'day': day[0:3], - 'start_time': opening_hour, - 'end_time': closing_hour - }) return converted_schedules diff --git a/matsim_activity_to_matsim_schedule.py b/matsim_activity_to_matsim_schedule.py deleted file mode 100644 index cdd5dcf..0000000 --- a/matsim_activity_to_matsim_schedule.py +++ /dev/null @@ -1,19 +0,0 @@ -class MatsimActivityToMatsimSchedule: - """ - Hub function to nrcan construction function class - """ - def __init__(self): - self._dictionary = { - 'work': '08:00:00-18:00:00', - 'home': '00:00:00-30:00:00', - 'edu': '08:00:00-18:00:00', - 'secondary': '08:00:00-20:00:00' - } - - @property - def dictionary(self) -> dict: - """ - Get the dictionary - :return: {} - """ - return self._dictionary diff --git a/matsim_engine.py b/matsim_engine.py index 6df3717..0890991 100644 --- a/matsim_engine.py +++ b/matsim_engine.py @@ -1,12 +1,4 @@ -import math import subprocess -import xmltodict - -import geopandas as gpd -from shapely.geometry import Point - -from matsim_activity_to_matsim_schedule import MatsimActivityToMatsimSchedule -from hub_function_to_matsim_activity import HubFunctionToMatsimActivity class MatSimEngine: def __init__(self, config_file_path): @@ -20,4 +12,4 @@ class MatSimEngine: # Must generate this config file first. command.append(self._config_file_path) - subprocess.run(command) + subprocess.run(command, check=True) diff --git a/matsim_visualizer.py b/matsim_visualizer.py index 4163385..c35f878 100644 --- a/matsim_visualizer.py +++ b/matsim_visualizer.py @@ -8,7 +8,7 @@ from collections import defaultdict import matplotlib.cm as cm import matplotlib.colors as colors -class MatSimVisualizer(): +class MatsimVisualizer(): def __init__(self, network_file_path, events_file_path): self.network_file_path = network_file_path self.events_file_path = events_file_path @@ -92,7 +92,7 @@ class MatSimVisualizer(): edge_widths = [2 + self.norm(traffic_data.get(link['id'], 0)) * 3 for link in self.links] plt.cla() - nx.draw(self.G, self.pos, node_size=10, node_color='blue', width=edge_widths, edge_color=edge_colors, with_labels=False, + nx.draw(self.G, self.pos, node_size=0, node_color='blue', width=edge_widths, edge_color=edge_colors, with_labels=False, edge_cmap=self.cmap) plt.title(f"Time: {tick}") diff --git a/traffic_animation.gif b/traffic_animation.gif new file mode 100644 index 0000000..cd50277 Binary files /dev/null and b/traffic_animation.gif differ