Giter Site home page Giter Site logo

pygraphhopper's Introduction

pyGraphhopper

A utility which allows you to use openstreetmap using graphhopper in python. It uses py4j to bridge between java and python.

Prerequisites

  1. Java
  2. Python
  3. py4j python module globally
  4. The pbf file of open street map for the locality you want to work upon. (e.g. http://download.geofabrik.de/asia/indonesia-latest.osm.pbf)

Installing

  1. Get the pbf file at desired dir. e.g.
wget http://download.geofabrik.de/asia/indonesia-latest.osm.pbf
  1. Install the java dependencies
mvn clean
mvn install dependency:copy-dependencies
mvn install
  1. Start the java gateway server:
java -cp ./target/route_distance-1.0-SNAPSHOT.jar:./target/dependency/* pygraphhopper.Gateway
  1. APIs are ready to be called form python:
from py4j.java_gateway import JavaGateway
#Creating bridge to Java gateway!
gateway = JavaGateway()
routeCalculator = gateway.entry_point.getRCObject("osm_work_dir", "car", "indonesia-latest.osm.pbf")
routeCalculator.getDistance(orig_lat, orig_lon, dest_lat, dest_lon, "car")

APIs:

  1. getRouteDistance: routeCalculator.getDistance

    This function returns the actual route distance between two geolocations given the type of compute (walk/car)

  2. processFiles: routeCalculator.mainHelper

    To calculate the route distance for a set of geolocations in a csv.

TODO:

Add more APIs provided by graphhopper, only calculate route distance is being provided right now.

Contribution

Pick something from TODO list and raise PR. :) Earn as many thanks as possible.

License

This project is licensed under the MIT License.

Acknowledgments

pygraphhopper's People

Contributors

mannuscript avatar

Watchers

 avatar  avatar

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.