New jar to account for crs
This commit is contained in:
parent
47b26c4882
commit
e81a4bf8d6
Binary file not shown.
Binary file not shown.
5
main.py
5
main.py
|
@ -1,4 +1,7 @@
|
||||||
|
import gzip
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from hub.imports.geometry_factory import GeometryFactory
|
from hub.imports.geometry_factory import GeometryFactory
|
||||||
|
@ -32,7 +35,7 @@ try:
|
||||||
visualizer = MatsimVisualizer(
|
visualizer = MatsimVisualizer(
|
||||||
'output_files/Montreal',
|
'output_files/Montreal',
|
||||||
'output_files',
|
'output_files',
|
||||||
(3854635.608067, 6040255.047194, 3855550.392442, 6039416.667303),
|
(3853903.627142, 6041373.293774, 3856702.336973, 6038057.730141),
|
||||||
True
|
True
|
||||||
)
|
)
|
||||||
visualizer.visualize()
|
visualizer.visualize()
|
||||||
|
|
Binary file not shown.
52
matsim.py
52
matsim.py
|
@ -27,7 +27,7 @@ MONTREAL_RIGHT = 3863759.595656
|
||||||
|
|
||||||
|
|
||||||
class Matsim:
|
class Matsim:
|
||||||
def __init__(self, city, output_file_path):
|
def __init__(self, city, output_file_path, crs="EPSG:26911"):
|
||||||
"""
|
"""
|
||||||
Constructs a Matsim exporter instance with a city object and an output file path.
|
Constructs a Matsim exporter instance with a city object and an output file path.
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class Matsim:
|
||||||
"""
|
"""
|
||||||
self._city = city
|
self._city = city
|
||||||
self._output_file_path = output_file_path
|
self._output_file_path = output_file_path
|
||||||
|
self._crs = crs
|
||||||
self._facilities = {
|
self._facilities = {
|
||||||
'name': self._city.name + ' Facilities',
|
'name': self._city.name + ' Facilities',
|
||||||
'facility': []
|
'facility': []
|
||||||
|
@ -133,7 +133,8 @@ class Matsim:
|
||||||
"-jar", jar_path,
|
"-jar", jar_path,
|
||||||
"input_files/merged-network.osm.pbf",
|
"input_files/merged-network.osm.pbf",
|
||||||
f"{self._output_file_path}/buildings_shapefile.shp",
|
f"{self._output_file_path}/buildings_shapefile.shp",
|
||||||
f"{self._output_file_path}/{self._city.name}_network.xml.gz"
|
f"{self._output_file_path}/{self._city.name}_network.xml.gz",
|
||||||
|
self._crs
|
||||||
]
|
]
|
||||||
subprocess.run(command)
|
subprocess.run(command)
|
||||||
|
|
||||||
|
@ -141,11 +142,10 @@ class Matsim:
|
||||||
"""
|
"""
|
||||||
Generates and exports the city's population data to an XML file.
|
Generates and exports the city's population data to an XML file.
|
||||||
"""
|
"""
|
||||||
try:
|
|
||||||
|
|
||||||
population = etree.Element("population")
|
population = etree.Element("population")
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
try:
|
||||||
# Generate work facilities
|
# Generate work facilities
|
||||||
work = []
|
work = []
|
||||||
for facility in self._facilities['facility']:
|
for facility in self._facilities['facility']:
|
||||||
|
@ -325,34 +325,22 @@ class Matsim:
|
||||||
('typicalDuration', '13:00:00'),
|
('typicalDuration', '13:00:00'),
|
||||||
('minimalDuration', '01: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 facility in self._facilities['facility']:
|
||||||
|
if not any(activity[0] == facility['activity'][0]['type'] for activity in activity_paramsets):
|
||||||
|
activity_paramsets.append(
|
||||||
|
(facility['activity'][0]['type'], [
|
||||||
|
('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:
|
for activity_type, parameters in activity_paramsets:
|
||||||
_add_parameterset(scoring_paramset, "activityParams", [("activityType", activity_type)] + parameters)
|
_add_parameterset(scoring_paramset, "activityParams", [("activityType", activity_type)] + parameters)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user