Skip to content

Commit

Permalink
Oneways fix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MKuranowski committed Oct 23, 2017
1 parent 05ad350 commit ab4d9c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 6 additions & 9 deletions pyroutelib3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
__copyright__ = "Copyright 2007, Oliver White; Modifications: Copyright 2017, Mikolaj Kuranowski"
__credits__ = ["Oliver White", "Mikolaj Kuranowski"]
__license__ = "GPL v3"
__version__ = "0.4"
__version__ = "0.5"
__maintainer__ = "Mikolaj Kuranowski"
__email__ = "[email protected]"

Expand Down Expand Up @@ -250,10 +250,10 @@ def storeWay(self, wayID, tags, nodes):
(node_id, x, y) = node
if last[0]:
if weight != 0:
if oneway not in ("-1"):
if oneway not in ["-1"]:
self.addLink(last[0], node_id, weight)
self.makeNodeRouteable(last)
if oneway not in ("yes", "true", "1") or self.transport == 'foot':
if oneway not in ["yes", "true", "1"] or self.transport == 'foot':
self.addLink(node_id, last[0], weight)
self.makeNodeRouteable(node)
last = node
Expand All @@ -263,12 +263,9 @@ def makeNodeRouteable(self, node):

def addLink(self, fr, to, weight=1):
"""Add a routeable edge to the scenario"""
try:
if to in list(self.routing[fr].keys()):
return
self.routing[fr][to] = weight
except KeyError:
self.routing[fr] = {to: weight}
if fr not in self.routing:
self.routing[fr] = {}
self.routing[fr][to] = weight

def equivalent(self, tag):
"""Simplifies a bunch of tags to nearly-equivalent ones"""
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
name = "pyroutelib3",
packages = ["pyroutelib3"],
license = "GPL v3",
version = "0.4",
version = "0.5",
description = "Library for simple routing on OSM data",
long_description = readme,
author = "Oliver White",
maintainer = "Mikolaj Kuranowski",
maintainer_email = "[email protected]",
url = "https://github.com/MKuranowski/pyroutelib3",
download_url = "https://github.com/MKuranowski/pyroutelib3/archive/0.4.tar.gz",
download_url = "https://github.com/MKuranowski/pyroutelib3/archive/0.5.tar.gz",
keywords = "osm routing pyroutelib",
classifiers = [],
install_requires = ["osmapi"]
Expand Down

0 comments on commit ab4d9c2

Please sign in to comment.