Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into issue2982
Browse files Browse the repository at this point in the history
  • Loading branch information
ratrun committed Jun 10, 2024
2 parents cf67c11 + 835f2a2 commit 66ebc54
Show file tree
Hide file tree
Showing 109 changed files with 1,987 additions and 1,038 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
### 9.0 [not yet released]
### 10.0 [not yet released]

- constructor of BaseGraph.Builder uses byte instead of integer count.
- KeyValue is now KValue as it holds the value only. Note, the two parameter constructor uses one value for the forward and one for the backward direction (and no longer "key, value")

### 9.0 [23 Apr 2024]

- max_slope is now a signed decimal, see #2955
- move sac_scale handling out of foot_access parser and made foot safer via lowering to sac_scale<2, same for hike sac_scale<5
Expand Down
95 changes: 52 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,37 @@ can import [other data sources too](README.md#OpenStreetMap-Support).

# Community

We have an open community and welcome everyone. Let us know your problems, use cases or just [say hello](https://discuss.graphhopper.com/). Please see our [community guidelines](https://graphhopper.com/agreements/cccoc.html).
We have an open community and welcome everyone. Let us know your problems, use cases or just [say hello](https://discuss.graphhopper.com/).
Please see our [community guidelines](https://graphhopper.com/agreements/cccoc.html).

## Questions

All questions go to our [forum](https://discuss.graphhopper.com/) where we also have subsections specially for developers, mobile usage, and [our map matching component](./map-matching). You can also search [Stackoverflow](http://stackoverflow.com/questions/tagged/graphhopper) for answers. Please do not use our issue section for questions :)
All questions go to our [forum](https://discuss.graphhopper.com/) where we also have subsections specially for developers, mobile usage, and [our map matching component](./map-matching).
You can also search [Stackoverflow](http://stackoverflow.com/questions/tagged/graphhopper) for answers.

## Contribute

Read through [how to contribute](CONTRIBUTING.md) for information on topics
like finding and fixing bugs and improving our documentation or translations!
We even have [good first issues](https://github.com/graphhopper/graphhopper/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) to get started.
Read through our [contributing guide](CONTRIBUTING.md) for information on topics
like finding and fixing bugs and improving our documentation or translations!
We also have [good first issues](https://github.com/graphhopper/graphhopper/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
to get started with contribution.

## Get Started

To get started you can try [GraphHopper Maps](README.md#graphhopper-maps), read through our documentation and install the GraphHopper Web Service locally.
To get started you can try [GraphHopper Maps](README.md#graphhopper-maps), read through [our documentation](./docs/index.md) and install GraphHopper including the Maps UI locally.

* 8.x: [documentation](https://github.com/graphhopper/graphhopper/blob/8.x/docs/index.md)
, [web service jar](https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/8.0/graphhopper-web-8.0.jar)
, [announcement](https://www.graphhopper.com/blog/2023/10/18/graphhopper-routing-engine-8-0-released/)
* 9.x: [documentation](https://github.com/graphhopper/graphhopper/blob/9.x/docs/index.md)
, [web service jar](https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/9.1/graphhopper-web-9.1.jar)
, [announcement](https://www.graphhopper.com/blog/2024/04/23/graphhopper-routing-engine-9-0-released)
* unstable master: [documentation](https://github.com/graphhopper/graphhopper/blob/master/docs/index.md)

<details><summary>Click to see older releases</summary>

* See our [changelog file](./CHANGELOG.md) for Java API Changes.

* 8.x: [documentation](https://github.com/graphhopper/graphhopper/blob/8.x/docs/index.md)
, [web service jar](https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/8.0/graphhopper-web-8.0.jar)
, [announcement](https://www.graphhopper.com/blog/2023/10/18/graphhopper-routing-engine-8-0-released/)
* 7.x: [documentation](https://github.com/graphhopper/graphhopper/blob/7.x/docs/index.md)
, [web service jar](https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/7.0/graphhopper-web-7.0.jar)
, [announcement](https://www.graphhopper.com/blog/2023/03/14/graphhopper-routing-engine-7-0-released/)
Expand Down Expand Up @@ -94,7 +100,7 @@ To get started you can try [GraphHopper Maps](README.md#graphhopper-maps), read
To install the [GraphHopper Maps](https://graphhopper.com/maps/) UI and the web service locally you [need a JVM](https://adoptium.net) (>= Java 17) and do:

```bash
wget https://repo1.maven.org/maven2/com/graphhopper/graphhopper-web/8.0/graphhopper-web-8.0.jar https://raw.githubusercontent.com/graphhopper/graphhopper/8.x/config-example.yml http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
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
```

Expand All @@ -114,9 +120,14 @@ To see the road routing feature of GraphHopper in action please go to [GraphHopp

[![GraphHopper Maps](https://www.graphhopper.com/wp-content/uploads/2022/10/maps2-1024x661.png)](https://graphhopper.com/maps)

GraphHopper Maps is an open source user interface, which you can find [here](https://github.com/graphhopper/graphhopper-maps). It can use this open source routing engine or the [GraphHopper Directions API](https://www.graphhopper.com), which provides the Routing API, a Route Optimization API (based on [jsprit](http://jsprit.github.io/)), a fast Matrix API and an address search (based on [photon](https://github.com/komoot/photon)). The photon project is also supported by the GraphHopper GmbH. Additionally to the GraphHopper Directions API, map tiles from various providers are used where the default is [Omniscale](http://omniscale.com/).
GraphHopper Maps is an open source user interface, which you can find [here](https://github.com/graphhopper/graphhopper-maps).
It can use this open source routing engine or the [GraphHopper Directions API](https://www.graphhopper.com),
which provides the Routing API, a Route Optimization API (based on [jsprit](http://jsprit.github.io/)),
a fast Matrix API and an address search (based on [photon](https://github.com/komoot/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](http://omniscale.com/).

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

## Public Transit

Expand All @@ -134,16 +145,18 @@ There is a [web service](./navigation) that can be consumed by [our navigation A

### Offline

Offline routing is [no longer officially supported](https://github.com/graphhopper/graphhopper/issues/1940) but should still work. See
[version 1.0](https://github.com/graphhopper/graphhopper/blob/1.0/docs/android/index.md) with still an Android
demo and [this pull request](http://github.com/graphhopper/graphhopper-ios) of the iOS fork including a demo for iOS.
Offline routing is [no longer officially supported](https://github.com/graphhopper/graphhopper/issues/1940)
but should still work as Android supports most of Java. See [version 1.0](https://github.com/graphhopper/graphhopper/blob/1.0/docs/android/index.md)
with the Android demo and also see [this pull request](http://github.com/graphhopper/graphhopper-ios) of the iOS fork including a demo for iOS.

[![simple routing](https://www.graphhopper.com/wp-content/uploads/2016/10/android-demo-screenshot-2.png)](./android/README.md)


## Analysis

Use isochrones to calculate and visualize the reachable area for a certain travel mode
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 Web API](./docs/web/api-doc.md#isochrone)

Expand All @@ -153,9 +166,6 @@ Use isochrones to calculate and visualize the reachable area for a certain trave

[![high precision reachability image](https://www.graphhopper.com/wp-content/uploads/2018/06/berlin-reachability-768x401.png)](https://www.graphhopper.com/blog/2018/07/04/high-precision-reachability/)

To support these high precision reachability approaches there is the /spt
endpoint (shortest path tree). [See #1577](https://github.com/graphhopper/graphhopper/pull/1577)

### [Map Matching](./map-matching)

There is the map matching subproject to snap GPX traces to the road.
Expand Down Expand Up @@ -229,34 +239,33 @@ 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](https://graphhopper.com/blog/2016/01/19/alternative-roads-to-rome/).
A fast and production ready map visualization for the Desktop can be implemented via [mapsforge](https://github.com/mapsforge/mapsforge) or [mapsforge vtm](https://github.com/mapsforge/vtm).
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](https://graphhopper.com/blog/2016/01/19/alternative-roads-to-rome/).
A fast and production-ready map visualization for the Desktop can be implemented via [mapsforge](https://github.com/mapsforge/mapsforge) or [mapsforge vtm](https://github.com/mapsforge/vtm).

# Features

Here is a list of the more detailed 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](https://github.com/graphhopper/graphhopper/pull/621), ...
* 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](./docs/core/low-level-api.md) is tuned towards ease of use and efficiency
* Pre-built routing profiles: car, bike, racing bike, mountain bike, foot, hike, motorcycle, ...
* [Customization of these profiles](./docs/core/profiles.md#custom-profiles) are possible and e.g. get truck routing or support for cargo bikes and [many other changes](https://www.graphhopper.com/blog/2020/05/31/examples-for-customizable-routing/)
* Pre-built routing profiles: car, bike, racing bike, mountain bike, foot, hike, truck, bus, motorcycle, ...
* [Customization of these profiles](./docs/core/profiles.md#custom-profiles) are possible. Read about it [here](https://www.graphhopper.com/blog/2020/05/31/examples-for-customizable-routing/).
* Provides a powerful [web API](./docs/web/api-doc.md) that exposes the data from OpenStreetMap and allows customizing the vehicle profiles per request. With JavaScript and Java clients.
* Does [map matching](./map-matching)
* Supports public transit routing and [GTFS](./reader-gtfs/README.md).
* Offers turn instructions in more than 45 languages, contribute or improve [here](./docs/core/translations.md)
* Displays and takes into account [elevation data](./docs/core/elevation.md)
* [Alternative routes](https://discuss.graphhopper.com/t/alternative-routes/424)
* [Turn costs and restrictions](./docs/core/turn-restrictions.md)
* 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](https://github.com/graphhopper/graphhopper/pull/1485))
* Calculates isochrones and [shortest path trees](https://github.com/graphhopper/graphhopper/pull/1577)
* Shows the whole road network in the browser for debugging purposes ("vector tile support") [#1572](https://github.com/graphhopper/graphhopper/pull/1572)
* Shows details along a route like road_class or max_speed ("path details") [#1142](https://github.com/graphhopper/graphhopper/pull/1142)
* Written Java and simple start for developers via Maven.
* Provides [map matching](./map-matching) i.e. "snap to road".
* Supports time-dependent public transit routing and reading [GTFS](./reader-gtfs/README.md).
* Offers turn instructions in more than 45 languages. Contribute or improve [here](./docs/core/translations.md).
* Displays and takes into account [elevation data](./docs/core/elevation.md).
* Supports [alternative routes](https://discuss.graphhopper.com/t/alternative-routes/424).
* Supports [turn costs and restrictions](./docs/core/turn-restrictions.md).
* 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](https://github.com/graphhopper/graphhopper/pull/1485)).
* Calculates isochrones and [shortest path trees](https://github.com/graphhopper/graphhopper/pull/1577).
* Shows the whole road network in the browser for debugging purposes ("vector tile support"), see [#1572](https://github.com/graphhopper/graphhopper/pull/1572).
* Shows so called "path details" along a route like road_class or max_speed, see [#1142](https://github.com/graphhopper/graphhopper/pull/1142) or the web documentation.
* Written in Java and simple to start for developers via Maven.
4 changes: 2 additions & 2 deletions benchmark/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ measurement.count=5000 \
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}

echo "3 - big map with a custom model that is 'very customized', i.e. has many custom weighting rules"
echo "node-based CH + LM"
echo "node-based CH + LM + slow routing"
java -cp tools/target/graphhopper-tools-*-jar-with-dependencies.jar \
-XX:+UseParallelGC -Xmx20g -Xms20g \
com.graphhopper.tools.Measurement \
Expand All @@ -102,7 +102,7 @@ measurement.clean=true \
measurement.stop_on_error=true \
measurement.summaryfile=${SUMMARY_DIR}summary_big_very_custom.dat \
measurement.repeats=1 \
measurement.run_slow_routing=false \
measurement.run_slow_routing=true \
measurement.weighting=custom \
measurement.custom_model_file=benchmark/very_custom.json \
graph.encoded_values=max_width,max_height,toll,hazmat,road_access,road_class \
Expand Down
4 changes: 2 additions & 2 deletions client-hc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>directions-api-client-hc</artifactId>
<version>9.0-SNAPSHOT</version>
<version>10.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>GraphHopper Directions API hand-crafted Java Client.</name>

<parent>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-parent</artifactId>
<version>9.0-SNAPSHOT</version>
<version>10.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
18 changes: 15 additions & 3 deletions config-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ graphhopper:
# u_turn_costs: 60
custom_model_files: [car.json]

# You can use the following in-built profiles. After you start GraphHopper it will print which encoded values you'll have to add to graph.encoded_values in this config file.
#
# - name: foot
# custom_model_files: [foot.json, foot_elevation.json]
#
Expand All @@ -46,10 +48,20 @@ graphhopper:
#
# - name: mtb
# custom_model_files: [mtb.json, bike_elevation.json]
#
# # See the bus.json for more details.
# - name: bus
# turn_costs:
# vehicle_types: [bus, motor_vehicle]
# u_turn_costs: 60
# custom_model_files: [bus.json]
#
# Other custom models not listed here are: car4wd.json, motorcycle.json, truck.json or cargo-bike.json. You might need to modify and test them before production usage.
# See ./core/src/main/resources/com/graphhopper/custom_models and let us know if you customize them, improve them or create new onces!
# Also there is the curvature.json custom model which might be useful for a motorcyle profile or the opposite for a truck profile.
# Then specify a folder where to find your own custom model files:
# custom_models.directory: custom_models

# instead of the inbuilt custom models (see ./core/src/main/resources/com/graphhopper/custom_models)
# you can specify a folder where to find your own custom model files
# custom_models.directory: custom_models

# Speed mode:
# It's possible to speed up routing by doing a special graph preparation (Contraction Hierarchies, CH). This requires
Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<artifactId>graphhopper-core</artifactId>
<name>GraphHopper Core</name>
<version>9.0-SNAPSHOT</version>
<version>10.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>
GraphHopper is a fast and memory efficient Java road routing engine
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-parent</artifactId>
<version>9.0-SNAPSHOT</version>
<version>10.0-SNAPSHOT</version>
</parent>

<properties>
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/java/com/graphhopper/GraphHopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,11 @@ public static Map<String, PMap> parseEncodedValueString(String encodedValuesStr)
Map<String, PMap> encodedValuesWithProps = new LinkedHashMap<>();
Arrays.stream(encodedValuesStr.split(","))
.filter(evStr -> !evStr.isBlank())
.forEach(evStr -> encodedValuesWithProps.put(evStr.trim().split("\\|")[0], new PMap(evStr)));
.forEach(evStr -> {
String key = evStr.trim().split("\\|")[0];
if (encodedValuesWithProps.put(key, new PMap(evStr)) != null)
throw new IllegalArgumentException("duplicate encoded value in config graph.encoded_values: " + key);
});
return encodedValuesWithProps;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ String getFileName(double lat, double lon) {
String getDownloadURL(double lat, double lon) {
return getFileName(lat, lon) + ".hgt.zip";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ public void addCoordinatesToPointList(long id, PointList pointList) {
public void setTags(ReaderNode node) {
int tagIndex = Math.toIntExact(nodeTagIndicesByOsmNodeIds.get(node.getId()));
if (tagIndex == -1) {
long pointer = nodeKVStorage.add(node.getTags().entrySet().stream().map(m -> new KVStorage.KeyValue(m.getKey(),
m.getValue() instanceof String ? KVStorage.cutString((String) m.getValue()) : m.getValue())).
collect(Collectors.toList()));
long pointer = nodeKVStorage.add(node.getTags().entrySet().stream().collect(
Collectors.toMap(Map.Entry::getKey, // same key
e -> new KVStorage.KValue(e.getValue() instanceof String ? KVStorage.cutString((String) e.getValue()) : e.getValue()))));
if (pointer > Integer.MAX_VALUE)
throw new IllegalStateException("Too many key value pairs are stored in node tags, was " + pointer);
nodeTagIndicesByOsmNodeIds.put(node.getId(), (int) pointer);
Expand Down
Loading

0 comments on commit 66ebc54

Please sign in to comment.