Skip to content

Instantly share code, notes, and snippets.

Peter karussell

Block or report user

Report or block karussell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View map.js
import mapboxgl from 'mapbox-gl';
import {tilesUrl} from './config';
/**
* Represents the map that is displayed in the main view and deals with tiles etc., should be independent from
* any vector layers on top of it.
*/
export class Map {
constructor(container) {
@karussell
karussell / index.html
Last active Mar 19, 2019
Test UI to show roads from GraphHopper vector tiles endpoint https://github.com/graphhopper/graphhopper/tree/experimental-mvt
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.VectorGrid Points Example</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"/>
</head>
<body style='margin:0'>
View test-vector-tiles.java
Coordinate nw = num2deg(xInfo, yInfo, zInfo);
Coordinate se = num2deg(xInfo + 1, yInfo + 1, zInfo);
if ("mvt".equalsIgnoreCase(resultStr) && zInfo >= 10 && (nw.y < 49 && nw.y > 48.3) && (nw.x > 10.5 && nw.x < 11.5)) {
qr = locationIndex.findClosest((nw.y + se.y) / 2, (nw.x + se.x) / 2, edgeFilter);
if (!qr.isValid())
throw new IllegalArgumentException("Point not found:" + point);
queryGraph = new QueryGraph(graph);
queryGraph.lookup(Collections.singletonList(qr));
View test.java
List<Number[]> edgeList = isochrone.searchEdges(qr.getClosestNode());
IGeometryFilter acceptAllGeomFilter = geometry -> true;
// TODO: Your tile extent here
Envelope tileEnvelope = new Envelope(0d, 100d, 0d, 100d);
MvtLayerParams layerParams = new MvtLayerParams(); // Default extent
GeometryFactory geometryFactory = new GeometryFactory();
Geometry[] edgeListGeometry = new Geometry[edgeList.size()];
for (int edgeCounter = 0; edgeCounter < edgeList.size(); edgeCounter++) {
Number[] edge = edgeList.get(edgeCounter);
View flex-profile-examples.txt
# Use branch https://github.com/graphhopper/graphhopper/tree/flex_vehicleprofile
# See discussion https://discuss.graphhopper.com/t/flexible-vehicle-profiles/3612
######################################################
http://localhost:8989/maps/?point=51.037751%2C13.728061&point=51.047384%2C13.741236&locale=en&vehicle=foot
foot but avoid primary roads
######################################################
base: foot
max_speed: 6
@karussell
karussell / import-time.txt
Created Feb 28, 2019
optimization potential to make import faster
View import-time.txt
14h total import time for car, scooter, truck, small_truck:
0h 50: OSM planet data update
2h 20: OSM data import
0h 50: improve speed data based on speed model
2h 15: subnetwork calculation incl 50min removal
4h 00: CH preparation of 4 profiles with 4 threads
3h 20: LM preparation of 4 profiles with 4 threads
27h total for bike, foot, hike, mtb, racingbike
0h 50: OSM planet data update
@karussell
karussell / android-error1.txt
Last active Feb 11, 2019
GraphHopper Navigation Android Demo
View android-error1.txt
java.lang.AssertionError: Already disposed: Module: 'app'
at com.intellij.openapi.components.impl.ComponentManagerImpl.lambda$throwAlreadyDisposed$1(ComponentManagerImpl.java:248)
at com.intellij.openapi.application.ReadAction.lambda$run$1(ReadAction.java:53)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:959)
at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
at com.intellij.openapi.application.ReadAction.run(ReadAction.java:53)
at com.intellij.openapi.components.impl.ComponentManagerImpl.throwAlreadyDisposed(ComponentManagerImpl.java:246)
at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:239)
at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:149)
at com.intellij.facet.FacetManager.getInstance(FacetManager.java:31)
View test.md

Overview comments on #1247 on certain things not in the java docs:

  • we introduce a way to store the original first and last edge so that we do not need to store the turn cost multiple times (e.g. for every new shortcut)
  • The EdgeBasedNodeContractor plays the key part of this algorithm:
    • Assume source and target nodes s and t connected like *->s-->x-->t->* and you want to contract x (center node). In order to determine if a shortcut s->t is required the contractor implements the AggressiveStrategy class that searches from all incoming edges of s to all outgoing edges of t
    • The unidirectional, edge-based Dijkstra search is done in the separate WitnessPathSearcher class, handling lots of special cases (see EdgeBasedNodeContractorTest for more details)
    • General CH concept: if there is a witness path with weight w1 and a bridge path with w2, and it is w1<w2; only then you do not need to add a shortcut when contracting x
  • The current default for query time is the A* algorithm un
View error.log
01-19 11:27:54.200 995 995 D AndroidRuntime: Shutting down VM
01-19 11:21:42.057 32749 32749 E AndroidRuntime: FATAL EXCEPTION: main
01-19 11:21:42.057 32749 32749 E AndroidRuntime: Process: com.graphhopper.navigation.example, PID: 32749
01-19 11:21:42.057 32749 32749 E AndroidRuntime: com.mapbox.mapboxsdk.c.b: Cannot create a LatLngBounds from 1 items
01-19 11:21:42.057 32749 32749 E AndroidRuntime: at com.mapbox.mapboxsdk.geometry.LatLngBounds$a.a(Unknown Source:24)
01-19 11:21:42.057 32749 32749 E AndroidRuntime: at com.graphhopper.navigation.example.NavigationLauncherActivity.a(Unknown Source:439)
01-19 11:21:42.057 32749 32749 E AndroidRuntime: at com.graphhopper.navigation.example.b.a(Unknown Source:2)
01-19 11:21:42.057 32749 32749 E AndroidRuntime: at com.graphhopper.navigation.example.b.onPostExecute(Unknown Source:2)
01-19 11:21:42.057 32749 32749 E AndroidRuntime: at android.os.AsyncTask.finish(AsyncTask.java:695)
01-19 11:21:42.057 32749 32749 E AndroidRuntime: at android.os.AsyncTask.ac
View hs_err_pid26499.log
This file has been truncated, but you can view the full file.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 5392 bytes for AllocateHeap
# Possible reasons:
# The system is out of physical RAM or swap space
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
You can’t perform that action at this time.