Giter Club home page Giter Club logo

pyroutelib2's Introduction

pyroutelib2's People

Contributors

gaulinmp avatar micolous avatar reixd avatar wesitos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyroutelib2's Issues

License of this code

What license is associated with the code of this repository? I know that Pyroute is GNU GPL. So, is Pyroutelib2 also GNU GPL?

Enhancement suggestion: uses of geodesic distance calculation

As an enhancement, the following patch uses the geopy library Vincenty (aliased as geopy.distance.distance) to calculate the geodesic distance between two points. The patch does introduce a dependency on the geopy library, but when tested I found it reduced the number files needed for caching and the time to run by 20-30%. (YMMV.)

@@ -28,6 +28,8 @@
import sys
import math
from loadOsm import LoadOsm
+from geopy import Point
+import geopy.distance

class Router(object):
def init(self, data):
@@ -39,10 +41,9 @@ class Router(object):
lat2 = self.data.rnodes[n2][0]
lon2 = self.data.rnodes[n2][1]
# TODO: projection issues

  • dlat = lat2 - lat1
  • dlon = lon2 - lon1
  • dist2 = dlat * dlat + dlon * dlon
  • dist = math.sqrt(dist2)
  • p1 = Point(lat1, lon1)
  • p2 = Point(lat2, lon2)
  • dist = geopy.distance.distance(p1,p2).km
    return(dist)

def doRoute(self,start,end):

Issue with routing railways

I can't get routing for train journeys to work, that is calling the LoadOSM("train").

Having had a look I think this is because the weight variable in the loadOsm.py always seems to be set to 0.0 as it is called with the highway rather than highway and/or railway option. Or I being daft and have missed something obvious?

The following patch which concatenates the railway and highway strings variables seems to fix the issue:

diff --git a/loadOsm.py b/loadOsm.py
index e149ad9..08f0f0a
--- a/loadOsm.py
+++ b/loadOsm.py
@@ -123,7 +123,7 @@ class LoadOsm:
(node_id,x,y) = node
if last[0]:
if(access[self.transport]):

  •      weight = self.weights.get(self.transport, highway)
    
  •      weight = self.weights.get(self.transport, (railway + highway))
       self.addLink(last[0], node_id, weight)
       self.makeNodeRouteable(last)
       if reversible or self.transport == 'foot':
    

Too slow :(

Hi,
I am writting simple app and I have to use some routing. I saw that route is calculate very slow (road around 5km/3miles in 40sec). Do you know what is a reason? How can I improve it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.