diff --git a/orm_importer/importer.py b/orm_importer/importer.py index 0beb2db..3c269b3 100644 --- a/orm_importer/importer.py +++ b/orm_importer/importer.py @@ -39,8 +39,12 @@ def __init__(self): self.api = overpy.Overpass(url="https://osm.hpi.de/overpass/api/interpreter") self.topology = Topology() - def _get_track_objects(self, polygon: str): - query = f'(way["railway"="rail"](poly: "{polygon}");node(w)(poly: "{polygon}"););out body;' + def _get_track_objects(self, polygon: str, railway_option_types: list[str]): + query_parts = "" + for type in railway_option_types: + query_parts = query_parts + f'way["railway"="{type}"](poly: "{polygon}");node(w)(poly: "{polygon}");' + query = f'({query_parts});out body;' + print(query) return self._query_api(query) def _query_api(self, query): @@ -141,8 +145,8 @@ def _should_add_edge(self, node_a: model.Node, node_b: model.Node, path: list[in present_paths = self.paths[(node_a, node_b)] + self.paths[(node_b, node_a)] return path not in present_paths and reversed_path not in present_paths - def run(self, polygon): - track_objects = self._get_track_objects(polygon) + def run(self, polygon, railway_option_types): + track_objects = self._get_track_objects(polygon, railway_option_types) self.graph = self._build_graph(track_objects) # ToDo: Check whether all edges really link to each other in ORM or if there might be edges missing for nodes that are just a few cm from each other diff --git a/pyproject.toml b/pyproject.toml index 406b8cf..a138bed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] name = "orm-importer" -version = "1.0.0" +version = "1.1.0" description = "This tool converts data from OpenRailwayMap into yaramo models." -authors = ["Your Name "] +authors = ["OSM@HPI "] license = "MIT" readme = "README.md" packages = [{include = "orm_importer"}]