Giter Club home page Giter Club logo

graphhopper-maps's Introduction

GraphHopper Routing Engine

Build Status

GraphHopper is a fast and memory-efficient routing engine released under Apache License 2.0. It can be used as a Java library or standalone web server to calculate the distance, time, turn-by-turn instructions and many road attributes for a route between two or more points. Beyond this "A-to-B" routing it supports "snap to road", Isochrone calculation, mobile navigation and more. GraphHopper uses OpenStreetMap and GTFS data by default and it can import other data sources too.

Community

We have an open community and welcome everyone. Let us know your problems, use cases or just say hello. Please see our community guidelines.

Questions

All questions go to our forum where we also have subsections specially for developers, mobile usage, and our map matching component. You can also search Stackoverflow for answers.

Contribute

Read through our contributing guide for information on topics like finding and fixing bugs and improving our documentation or translations! We also have good first issues to get started with contribution.

Get Started

To get started you can try GraphHopper Maps, read through our documentation and install GraphHopper including the Maps UI locally.

Click to see older releases

Installation

To install the GraphHopper Maps UI and the web service locally you need a JVM (>= Java 17) and do:

wget https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/9.1/graphhopper-web-9.1.jar https://raw.githubusercontent.com/graphhopper/graphhopper/9.x/config-example.yml http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
java -D"dw.graphhopper.datareader.file=berlin-latest.osm.pbf" -jar graphhopper*.jar server config-example.yml

After a while you see a log message with 'Server - Started', then go to http://localhost:8989/ and you'll see a map of Berlin. You should be able to right click on the map to create a route.

See the documentation that contains e.g. the elevation guide and the deployment guide.

Docker

The Docker images created by the community from the master branch can be found here (currently daily). See the Dockerfile for more details.

GraphHopper Maps

To see the road routing feature of GraphHopper in action please go to GraphHopper Maps.

GraphHopper Maps

GraphHopper Maps is an open source user interface, which you can find here. It can use this open source routing engine or the GraphHopper Directions API, which provides the Routing API, a Route Optimization API (based on jsprit), a fast Matrix API and an address search (based on photon). The photon project is also supported by the GraphHopper GmbH. Additionally to the GraphHopper Directions API, map tiles from various providers are used, with the default being Omniscale.

All this is available for free, via encrypted connections and from German servers - for a nice and private route planning experience!

Public Transit

Get started

Realtime Demo

Mobile Apps

Online

There is a web service that can be consumed by our navigation Android client.

android navigation demo app

Offline

Offline routing is no longer officially supported but should still work as Android supports most of Java. See version 1.0 with the Android demo and also see this pull request of the iOS fork including a demo for iOS.

simple routing

Analysis

Use isochrones to calculate and visualize the reachable area for a certain travel mode.

You can try the debug user interface at http://localhost:8989/maps/isochrone to see the /isochrone and /spt endpoint in action.

Isochrone API image

high precision reachability image

There is the map matching subproject to snap GPX traces to the road.

map-matching-example

Technical Overview

GraphHopper supports several routing algorithms, such as Dijkstra and A* and its bidirectional variants. Furthermore, it allows you to use Contraction Hierarchies (CH) very easily. We call this speed mode; without this CH preparation, we call it flexible mode.

The speed mode comes with very fast and lightweight (less RAM) responses and it does not use heuristics. However, only predefined vehicle profiles are possible and this additional CH preparation is time and resource consuming.

Then there is the hybrid mode which also requires more time and memory for the preparation, but it is much more flexible regarding changing properties per request or e.g. integrating traffic data. Furthermore, this hybrid mode is slower than the speed mode, but it is an order of magnitude faster than the flexible mode and uses less RAM for one request.

If the preparations exist you can switch between all modes at request time.

Read more about the technical details here.

License

We chose the Apache License to make it easy for you to embed GraphHopper in your products, even closed source. We suggest that you contribute back your changes, as GraphHopper evolves fast.

OpenStreetMap Support

OpenStreetMap is directly supported by GraphHopper. Without the amazing data from OpenStreetMap, GraphHopper wouldn't be possible at all. Other map data will need a custom import procedure, see e.g. Ordnance Survey, Shapefile like ESRI or Navteq.

Written in Java

GraphHopper is written in Java and officially runs on Linux, Mac OS X and Windows.

Maven

Embed GraphHopper with OpenStreetMap support into your Java application via the following snippet:

<dependency>
    <groupId>com.graphhopper</groupId>
    <artifactId>graphhopper-core</artifactId>
    <version>[LATEST-VERSION]</version>
</dependency>

See our example application to get started fast.

Customizable

You can customize GraphHopper with Java knowledge (with a high and low level API) and also without Java knowledge using the custom models.

Web API

With the web module, we provide code to query GraphHopper over HTTP and decrease bandwidth usage as much as possible. For that we use an efficient polyline encoding, the Ramer–Douglas–Peucker algorithm, and a simple GZIP servlet filter.

On the client side, we provide a Java and JavaScript client.

Desktop

GraphHopper also runs on the Desktop in a Java application without internet access. For debugging purposes GraphHopper can produce vector tiles, i.e. a visualization of the road network in the browser (see #1572). Also a more low level Swing-based UI is provided via MiniGraphUI in the tools module, see some visualizations done with it here. A fast and production-ready map visualization for the Desktop can be implemented via mapsforge or mapsforge vtm.

Features

  • Works out of the box with OpenStreetMap (osm/xml and pbf) and can be adapted to custom data
  • OpenStreetMap integration: stores and considers road type, speed limit, the surface, barriers, access restrictions, ferries, conditional access restrictions and more
  • GraphHopper is fast. And with the so called "Contraction Hierarchies" it can be even faster (enabled by default).
  • Memory efficient data structures, algorithms and the low and high level API is tuned towards ease of use and efficiency
  • Pre-built routing profiles: car, bike, racing bike, mountain bike, foot, hike, truck, bus, motorcycle, ...
  • Customization of these profiles are possible. Read about it here.
  • Provides a powerful web API that exposes the data from OpenStreetMap and allows customizing the vehicle profiles per request. With JavaScript and Java clients.
  • Provides map matching i.e. "snap to road".
  • Supports time-dependent public transit routing and reading GTFS.
  • Offers turn instructions in more than 45 languages. Contribute or improve here.
  • Displays and takes into account elevation data.
  • Supports alternative routes.
  • Supports turn costs and restrictions.
  • Offers country-specific routing via country rules.
  • Allows customizing routing behavior using custom areas.
  • The core uses only a few dependencies (hppc, jts, janino and slf4j).
  • Scales from small indoor-sized to world-wide-sized graphs.
  • Finds nearest point on street e.g. to get elevation or 'snap to road' or being used as spatial index (see #1485).
  • Calculates isochrones and shortest path trees.
  • Shows the whole road network in the browser for debugging purposes ("vector tile support"), see #1572.
  • Shows so called "path details" along a route like road_class or max_speed, see #1142 or the web documentation.
  • Written in Java and simple to start for developers via Maven.

graphhopper-maps's People

Contributors

easbar avatar janekdererste avatar karussell avatar kriegalex avatar oblonski avatar otbutz avatar ratrun avatar rokcarl avatar sachsenspieltcoding 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  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  avatar

graphhopper-maps's Issues

Map query in url

update the url parameter in the browser window to make the query reproducible

Have only point coordinates until reverse geoconding is added

improvements towards via points

This is currently important (as the old GH maps allows a lot):

  • ability to add more than 3 via points
  • use scrollbar somehow if too many via points. Currently several elements disappear on Desktop if adding more and more via points.
  • insert via points in the correct order through right click
  • drag and drop of the points in the left panel to reorder points

related #143

Convert api into class

While starting unit testing on QueryStore I had trouble mocking the api functions. To make things easier when testing convert the collection of api functions into a class which can be injected into e.g. the QueryStore. This way it can be easily mocked with jest

  • Convert Api into class
  • inject api object where needed
  • Maybe divide Api types and Api implementation into separate files?
  • Fix api unit tests
  • Write up Unit tests for Query Store

Implement geocoding

We need two way geocoding.

  1. When markers are set on the map an adress close by needs to be searched and displayed in the search box
  2. When an adress is entered into the serach box an according coordiante needs to be resolved

The original gh-maps-client already did something on this topic probably @karussell kann give some insight on this.

gpx support

without dialog - create it client-side as we could need it for all alternatives.

leaving input with tab should work (keyboard navigation)

When I type a location in the first input, then "tab" into second, then type a location in the second input and hit return it should show the route. Currently it is required that I select a location from both suggestion lists to update the route.

Also when copy and pasting a location as coordinate it does not route although no geocoding needs to be done.

Display path details without elevation data

It would be nice to have the graph also available for debugging purposes even if no elevation data is present.

image

e.g display a flat 0m graph with color gradient for elevation=false + debug=true + details=

Import/export request json

There should be a way to initialize the app with some (route request) state and also export the current state. Low-level editing of the request state would also be useful. So far this was possible by editing the URL in the browser's address box, but especially with custom models the URL will become too long.

Maybe there should be a (somewhat hidden) text box that displays the route request as JSON. This way users can easily copy the request to include it somewhere else in their application (use it against the Directions API for example) or share it somewhere to report a routing related problem etc.

Editing this text box would allow setting low-level parameters that are not covered elsewhere in the UI and this way we could also import the JSON that was exported by someone else. We probably need some basic validation for this such that the UI won't be in a broken state in case invalid JSON is inserted.

Not sure yet, just leaving this here for discussion.

Create better layout for mobile/small screens

The current approach looks good on large window sizes but takes up too much space on small screens.

  • The logo needs too much space (I think it takes up too much space in every case)
  • Route alternatives are displayed as rows. This takes too much horizontal screen space
  • The search box itself takes up too much space especially when more via points are displayed
  • close or hide elevation widget

Load multiple route alternatives

As qwant/google/bing maps we eventually want to display route alternatives.

To maintain a fast impressio maybe do two requests

  1. Request single route
  2. Request multiple routes after single route has been received

Maybe requesting multiple routes right away is also fast enough. This should be tested though

Improve bounding box for route

There are several things we can improve:

Do styling

Pretty buttons and stuff like that
Logo

Feature Request: center-on-location search box

I'd find it convenient to be able to center the map view to a specific latitude/longitude, as in the simple search box seen on common mapping services. In particular, when working with a route that has dozens of points covering hundreds of kilometers, it's difficult to home in on a specific place (e.g. a customer location) to see how the map routes nearby.

Add addresses to url

Currently the url only stores the coordinates of selected points. It should also store the addresstext of points if present

Add pretty markers

Add a marker symbol for query points.

Visually pick up markers to clarify which textbox changes which marker

context menu

  • adding start and end points
  • insert? (dragging route?)
  • delete

Interactive custom model editor improvements

Continuing from graphhopper/graphhopper#2239 the following things could/should be improved:

  • allow negating areas using == false
  • check syntax for areas section (geojson)
  • support boolean encoded values without ==/!= true/false? This is important especially for, e.g. if: true, limit to: 100
  • auto-convert tabs to spaces, visualize space characters -> no longer needed since we use json now
  • fix missing auto completion for e.g. road_class ==| MOTORWAY && in_berlin
  • support negation operator !
  • support heading penalty
  • enable soft wraps? disable line numbers, disable error icons in left gutter
  • full screen for editor?
  • show 'no suggestions' popup instead of not showing anything when there are no suggestions?
  • auto-complete some values, like empty lists for speed/priority, type: Polygon/Feature, else: "" etc.
  • support areas defined in server-side profiles, does this even work?
  • auto-complete for YAML JSON, especially speed/priority/areas/distance_influence/limit_to/multiply_by would be nice
  • give better feedback for hard-to-find indentation errors (maybe use match brackets api to find closing bracket) -> not as critical for JSON anymore, we use match brackets though
  • enable close-brackets: https://codemirror.net/demo/closebrackets.html
  • catch YAML JSON syntax errors that aren't caught currently, e.g. {}[].
  • maybe trigger autocomplete automatically without pressing Ctrl+Space? At least in certain cases? This way maybe users not familiar with auto-complete get to know it more easily.
  • probably related to above: update (or close?) auto-complete popup when user keeps typing after it was opened?
  • auto-complete for numeric encoded values? maybe just show a hint saying that one needs to enter a number? show "type a number" as suggestion and insert nothing when user presses enter
  • tweak CM 'mode' especially indentation is not useful at all, e.g. for almost all cases it does the opposite of what we want, see here: https://codemirror.net/doc/manual.html#modeapi -> not as critical for json, and we use a black font for now since the default (red) seems a bit too much
  • simplify error messages (now that they are shown at their origin) ?
  • maybe use tooltips to provide some documentation, e.g. for speed/priority/distance_influence
  • make it easy to translate error messages? but first make them as simple as possible.
  • maybe use code mirror bracket matching
  • adjust colors, theme and styles
  • check code mirror options to see if we need anything besides the defaults, maybe customize the 'mode'?
  • handle YAML multiline syntax like >+ and |... https://stackoverflow.com/a/21699210 we use JSON now
  • dark theme and VIM keybindings (just kidding...)

Layout breaks on iOS/Safari

Some things are not rendered correclty on iOS/Safari. Have this issue here to not forget about it since I'm not developing on a mac

  • Add Point button doesn't layout correctly
  • Select element is not styled nicely
  • Can't select routes on the map with current event listener setup
  • Elevation widget doesn't work on small screens (it is too big and needs to be layout differently)
  • Map Style Switch is not visibile on small screens

select vehicle

Select the vehicle used for the routing request. The following options are avaliable "car" "bike" "foot" "hike" "mtb" "racingbike" "scooter" "truck" "small_truck"

The info endpoint of the GH Server gives information about the supported vehicles by this very instance.

This issue inlcudes:

  • Parsing the supported vehicles from the info endpoint
  • Giving the user a way to choose a vehicle for routing from the supported vehicles
  • Add the vehicle parameter to the routing request
  • Add vehicle parameter to url

Implement marker handling

Add markers when clicking onto the map. Implementing the folowing behaviour for now:

  1. First left click: Place from marker
  2. Second left click: Place to marker and send query
  3. Next Click remove Markers and route go to 1.

add unit testing

This is something peter requested as well. Find a suitable unit testing framework and test things right from the beginning

Build is rather slow

Adding a single line of code requires more than 10s to rebuild on my laptop. Do we have to expect this is going to get worse? Is there something we can do about it? If not could it even be worth looking into other build tools like snowpack or vite for example?

Set up development server

I guess renting a box at Hetzner Cloud would suffice. Alternatively syncing the built app to an AWS Bucket would also work.

  • While at it, set up a continous deployment from travis.
  • Also, add a production webpack configuration with minification, tree shaking and all the other fuzz.

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.