Giter VIP home page Giter VIP logo

openrailrouting's Introduction

OpenStreetMap based routing on railway tracks

This is a prototype of a routing engine for railways based on a forked version of the GraphHopper routing engine and OpenStreetMap data.

Features

Following features are currently supported:

  • simple routing requests
  • map matching
  • isochrones
  • taking turn angles into account (to avoid U-turns on points)
  • disabling turns on railway crossings (OSM tag railway=railway_crossing)
  • support of tracks with multiple gauges
  • support of tracks with switchable voltage and frequency
  • support of different speeds in forward and backward direction

The configured vehicle profiles can:

  • use only tracks which have a compatible gauge
  • skip tracks without catenary if it is an electrical locomotive/electrical multiple unit
  • take the type of electrification (third rails vs. catenary) into account
  • avoid using tracks against theire preferred direction (useful for railway lines with multiple tracks)

Missing features:

  • taking the low acceleration and the long breaking distances of trains into account
  • a lot of features which would need data which is not in OSM (incline, structure gauges)
  • support for barriers (e.g. gates)

Web Frontend

This project includes a web frontend which is a fork of the original GraphHopper web frontend.

Building

This project uses Maven (for the Java code) and NodeJS for the web frontend for building. npm has to be installed.

git submodule init
git submodule update
mvn clean install

JUnit 5 is used for unit tests.

Configuration

You can configure OpenRailRouting by editing its GraphHopper configuration (YAML file). Please refer to config.yml for details.

Profiles

Each route request has to specify a profile. The available profiles are determined by the configuration when the graph is imported. Each profile consists of

  • name: name of the profile
  • turn_costs: turn costs
    • vehicle_types: vehicle types used for vehicle-specific turn restrictions. Available values: train, light_rail, tram, subway
    • u_turn_costs: time penality in seconds for reversing
  • custom_model_files: list of files that define the profile. The files are searched in src/main/resources/com/graphhopper/custom_profiles.

You can add an additional directory to the custom models search path by:

graphhopper:
  custom_models.directory: path/to/your/custom_models_directory

If you have your own separate custom models directory, you do not have to recompile OpenRailRouting after every change of the models.

Please refer to the GraphHopper documentation about custom models for a detailed explanation how custom models work. The following contains a few notes about differences between GraphHopper and OpenRailRouting.

In addition to the encoded values supported by GraphHopper, OpenRailRouting can encoded the following encoded values per edge:

  • voltage: decimal (precision: 100 Volt), missing values are encoded as 0.0
  • frequency: decimal (precision: 2.5 Hz), missing values are encoded as 0.0
  • electrified: enum (UNSET, NO, OTHER, CONTACT_LINE, RAIL)
  • gauge: integer, missing values are encoded as 0.0
  • railway_class: enum for the value of the OSM railway=* tag: RAIL, LIGHT_RAIL, TRAM, SUBWAY, NARROW_GAUGE, FUNICULAR
  • railway_service: enum for the value of the OSM service=* tag: NONE, SIDING, YARD, SPUR, CROSSOVER
  • preferred_direction: boolean value, true if the requested direction matches the preferred direction of operation of the track

In order to make use of these encoded values, you have to set them in the GraphHopper configuration using:

graphhopper:
  graph.encoded_values: gauge,voltage,electrified,frequency,road_environment,max_speed,rail_access,rail_average_speed,railway_class,railway_service

If an edge has multiple gauges, voltages, freuqencies or types of electrification (e.g. multi-gauge tracks or tracks), the edge is duplicated during import. As author of a custom model, you don't need to take this into account.

OpenRailRouting provides a few basic profiles where you can combine and built upon:

  • all_tracks.json accepts any track.
  • rail.json routes on any railway=rail
  • tramtrain.json routes on railway=rail/light_rail/tram
  • gauge_1435.json limits accessible tracks to those with gauge=1435 or missing gauge.
  • 15kv-ac_750v-dc.json limits accessible tracks to those with 15 kV 16.7 Hz AC, 750 V DC or missing information about power systems. Tracks with electrified=no/rail will be assumed as inaccessible.

Don't forget that clients can submit their own profiles at runtime if they use POST requests.

Running

To run the routing engine, execute

java -Xmx2500m -Xms50m \
  -Ddw.graphhopper.datareader.file=$OSMFILE \
  -jar target/railway_routing-0.0.1-SNAPSHOT.jar ACTION [ARGUMENTS] CONFIG_FILE [OPTARG]

The tool currently supports three different actions (ACTION above):

  • import to import the graph (graph will be stored at the subdirectory graph-cache/)
  • serve to listen to HTTP requests for the API and the web interface on the port specified in a YAML configuration file (see config.yml as an example). If no data has been imported, an import of the routing graph will happen first.
  • match do map matching. This command needs additional arguments called OPTARG above.

Import

Arguments:

  • --input, -i: Path to input file (.osm.pbf format)
  • --output, -o: Path to output directory where the graph should be written to

Required settings to be given either as Java system properties (-Dgraphhopper.datareader.file=PATH or in the YAML file):

  • graphhopper.datareader.file=$PATH: path to OSM file
  • graphhopper.graph.location=./graph-cache: directory where the graph should be written to (default: ./graph-cache)

Serve

Required settings to be given either as Java system properties (-Ddw.KEY=VALUE or in the configuration file):

  • dw.graphhopper.datareader.file=$PATH: path to OSM file
  • dw.graphhopper.graph.location=./graph-cache: directory where the graph should be read from (default: ./graph-cache)
  • dw.server.applicationConnector.port=$PORT: port to be opened by Jetty

Match

Required settings to be given either as Java system properties (-Ddw.KEY=VALUE or in the configuration file):

  • dw.graphhopper.datareader.file=$PATH: path to OSM file
  • dw.graphhopper.graph.location=./graph-cache: directory where the graph should be read from (default: ./graph-cache)

Following arguments have to be provided (not as Java system variables). You can retrieve this list by calling java -jar target/railway_routing-0.0.1-SNAPSHOT-jar-with-dependencies.jar match config.yml

  • --gpx-location=$PATTERN is required. This can be either a single GPX file or a wildcard pattern like /path/to/dir/mytracks/*.gpx. The resulting routes will be written as GPX files to same directory but .res.gpx will be appended to their file names. Wildcard patterns need to be enclosed with quotes (--gpx-location="path/to/files/*.gpx") to prevent your shell expanding the pattern.
  • -V VEHICLE, --vehicle=$VEHICLE: routing profile to be used.

Optional command line arguments:

  • -a NUMBER, --gps-accuracy=NUMBER: GPS accuracy in metres (default: 40)
  • --max_nodes=NUMBER: maximum number of nodes to visit between two trackpoints (default: 10,000)

License

See LICENSE.txt

See THIRD_PARTY.md for a list of all third-party code in this repository

Thank you

Development of this project has been supported by Geofabrik and SNCF.

openrailrouting's People

Contributors

arsenm avatar chrismayer avatar edwardbetts avatar joakimfors avatar jonasfranz avatar knowname avatar nakaner avatar njanakiev avatar woodpeck 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  avatar  avatar  avatar

Watchers

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

openrailrouting's Issues

Support railway:preferred_direction

The routing does not support railway:preferred_direction=forward/backward. Support for this tag should be added to make the routing choose the correct track on railway lines with two tracks.

cannot run the routing engine

Hi,
I followed the README to run the routing application using the given config.yml. I got the following error please assist what I am doing wrong. The end goal is to get the routing engine to route on South African railway only and then integrate with leaflet but first I need to get this prototype running and currently I just cannot run it .Please assist.

root@ctc-tms-dss2 OpenRailRouting]# java -Xmx2500m -Xms50m -Ddw.graphhopper.prepare.ch.weightings=no -Ddw.graphhopper.datareader.file=berlin-latest.osm.pbf -Dgraphhoper.graph.location=graph-cache -Ddw.graphhopper.profiles=freight_diesel -jar target/railway_routing-0.0.1-SNAPSHOT.jar serve config.yml
INFO [2023-08-30 08:32:29,004] org.eclipse.jetty.util.log: Logging initialized @1307ms to org.eclipse.jetty.util.log.Slf4jLog
INFO [2023-08-30 08:32:29,058] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO [2023-08-30 08:32:29,059] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
WARN [2023-08-30 08:32:29,059] de.geofabrik.railway_routing.http.RailwayRoutingServerConfiguration: The key dw.graphhopper.profiles cannot be supplied using Java system properties.
WARN [2023-08-30 08:32:29,059] de.geofabrik.railway_routing.http.RailwayRoutingServerConfiguration: The key dw.graphhopper.prepare.ch.weightings cannot be supplied using Java system properties.
INFO [2023-08-30 08:32:29,217] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: assets for path /maps/*
INFO [2023-08-30 08:32:29,219] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: assets for path /map-matching/*
WARN [2023-08-30 08:32:29,219] io.dropwizard.jetty.setup.ServletEnvironment: Overriding the existing servlet registered with the name: assets
INFO [2023-08-30 08:32:29,223] io.dropwizard.server.ServerFactory: Starting RailwayRoutingApplication
_ _
__ _ _ __ __ _ _ __ | |__ | |__ ___ _ __ _ __ ___ _ __
/ | '__/ _ | ' | '_ | '_ \ / _ | '_ | '_ \ / _ \ '|
| (| | | | (| | |) | | | | | | | () | |) | |) | / |
_, || _,| ./|| ||| ||_
/| ./| ./ _||
|
/ || || |_|
INFO [2023-08-30 08:32:29,326] org.eclipse.jetty.setuid.SetUIDListener: Opened application@1bb9aa43{HTTP/1.1, (http/1.1)}{localhost:8989}
INFO [2023-08-30 08:32:29,326] org.eclipse.jetty.setuid.SetUIDListener: Opened admin@420bc288{HTTP/1.1, (http/1.1)}{localhost:8990}
INFO [2023-08-30 08:32:29,329] org.eclipse.jetty.server.Server: jetty-9.4.39.v20210325; built: 2021-03-25T14:42:11.471Z; git: 9fc7ca5a922f2a37b84ec9dbc26a5168cee7e667; jvm 1.8.0_382-b05
INFO [2023-08-30 08:32:29,343] com.graphhopper.GraphHopper: version 6.0|2022-10-25T13:32:20Z (9,21,6,5,2,9)
ERROR [2023-08-30 08:32:29,380] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down
! java.lang.IllegalArgumentException: Encoder stadtbahn not found. Available encoders: [{name=tramtrain, railway=rail;light_rail;tram, electrified=contact_line, voltages=15000;15000;750, frequencies=16.7;16.67;0, gauges=1435, maxspeed=100, speed_factor=11.0, yardSpur=true}, {name=tgv_all, railway=rail, electrified=contact_line, voltages=15000;25000;1500;3000, frequencies=16.7;16.67;50;0, gauges=1435, maxspeed=319, speed_factor=11.0, yardSpur=true}, {name=non_tgv, railway=rail, electrified=, voltages=, frequencies=, gauges=1435, maxspeed=120, speed_factor=5.0, yardSpur=true}, {name=alltracks, railway=rail;light_rail;tram;subway;narrow_gauge, electrified=, voltages=, frequencies=, gauges=, maxspeed=120, speed_factor=5.0, yardSpur=true}, {name=allelectric, railway=rail, electrified=contact_line,yes, voltages=, frequencies=, gauges=, maxspeed=140, speed_factor=5.0, yardSpur=true}]
! at de.geofabrik.railway_routing.RailFlagEncoderFactory.createParser(RailFlagEncoderFactory.java:30)
! at com.graphhopper.GraphHopper.lambda$buildEncodingManagerAndOSMParsers$6(GraphHopper.java:658)
! at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
! at com.graphhopper.GraphHopper.buildEncodingManagerAndOSMParsers(GraphHopper.java:657)
! at com.graphhopper.GraphHopper.process(GraphHopper.java:788)
! at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:760)
! at de.geofabrik.railway_routing.http.RailwayRoutingManaged.start(RailwayRoutingManaged.java:32)
! at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
! at org.eclipse.jetty.server.Server.start(Server.java:423)
! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
! at org.eclipse.jetty.server.Server.doStart(Server.java:387)
! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:60)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
! at io.dropwizard.cli.Cli.run(Cli.java:78)
! at io.dropwizard.Application.run(Application.java:94)
! at de.geofabrik.railway_routing.http.RailwayRoutingApplication.main(RailwayRoutingApplication.java:36)
java.lang.IllegalArgumentException: Encoder stadtbahn not found. Available encoders: [{name=tramtrain, railway=rail;light_rail;tram, electrified=contact_line, voltages=15000;15000;750, frequencies=16.7;16.67;0, gauges=1435, maxspeed=100, speed_factor=11.0, yardSpur=true}, {name=tgv_all, railway=rail, electrified=contact_line, voltages=15000;25000;1500;3000, frequencies=16.7;16.67;50;0, gauges=1435, maxspeed=319, speed_factor=11.0, yardSpur=true}, {name=non_tgv, railway=rail, electrified=, voltages=, frequencies=, gauges=1435, maxspeed=120, speed_factor=5.0, yardSpur=true}, {name=alltracks, railway=rail;light_rail;tram;subway;narrow_gauge, electrified=, voltages=, frequencies=, gauges=, maxspeed=120, speed_factor=5.0, yardSpur=true}, {name=allelectric, railway=rail, electrified=contact_line,yes, voltages=, frequencies=, gauges=, maxspeed=140, speed_factor=5.0, yardSpur=true}]
at de.geofabrik.railway_routing.RailFlagEncoderFactory.createParser(RailFlagEncoderFactory.java:30)
at com.graphhopper.GraphHopper.lambda$buildEncodingManagerAndOSMParsers$6(GraphHopper.java:658)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at com.graphhopper.GraphHopper.buildEncodingManagerAndOSMParsers(GraphHopper.java:657)
at com.graphhopper.GraphHopper.process(GraphHopper.java:788)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:760)
at de.geofabrik.railway_routing.http.RailwayRoutingManaged.start(RailwayRoutingManaged.java:32)
at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
at org.eclipse.jetty.server.Server.start(Server.java:423)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at org.eclipse.jetty.server.Server.doStart(Server.java:387)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:60)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:94)
at de.geofabrik.railway_routing.http.RailwayRoutingApplication.main(RailwayRoutingApplication.java:36)

Too many total edges were removed error problem

Each time the error occurs: Too many total edges were removed error problem
my consoleoutput:

d:\develop\gpaphhopper_bin>java -Xmx1000m -Xms500m -Dlog4j2.configurationFile=lo
gging.xml  -jar railway_routing-0.0.1-SNAPSHOT-with-dep.jar action=web  graph.lo
cation=graph-cache datareader.file=lithuania-latest.osm.pbf jetty.port=8989 jett
y.resourcebase=webapp vehicle=rail
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$Ref
lectUtils$1 (file:/D:/develop/gpaphhopper_bin/railway_routing-0.0.1-SNAPSHOT-wit
h-dep.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],i
nt,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.
internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflect
ive access operations
WARNING: All illegal access operations will be denied in a future release
2018-04-15 11:29:50,257 [main] INFO  com.graphhopper.http.CmdArgsModule - jsonp
disabled
2018-04-15 11:30:11,137 [main] INFO  com.graphhopper.reader.osm.OSMReader - crea
ting graph. Found nodes (pillar+tower):10а670, totalMB:659, usedMB:367
2018-04-15 11:30:20,129 [main] INFO  com.graphhopper.reader.osm.OSMReader - 12а2
49а446, now parsing ways
2018-04-15 11:30:30,521 [main] INFO  com.graphhopper.reader.osm.OSMReader - 13а6
72а245, now parsing relations
2018-04-15 11:30:30,751 [main] INFO  com.graphhopper.reader.osm.OSMReader - fini
shed way processing. nodes: 2338, osmIdMap.size:10670, osmIdMap:0MB, nodeFlagsMa
p.size:0, relFlagsMap.size:0, zeroCounter:0 totalMB:997, usedMB:741
2018-04-15 11:30:30,753 [main] INFO  com.graphhopper.reader.osm.OSMReader - time
 pass1:20s, pass2:19s, total:40s
2018-04-15 11:30:30,757 [main] INFO  com.graphhopper.routing.subnetwork.PrepareR
outingSubnetworks - start finding subnetworks (min:200, min one way:0) totalMB:9
97, usedMB:741
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalStateExc
eption: Too many total edges were removed: 1879, all edges:2235
        at de.geofabrik.railway_routing.RailwayRoutingMain.web(RailwayRoutingMai
n.java:169)
        at de.geofabrik.railway_routing.RailwayRoutingMain.<init>(RailwayRouting
Main.java:68)
        at de.geofabrik.railway_routing.RailwayRoutingMain.main(RailwayRoutingMa
in.java:57)
Caused by: java.lang.IllegalStateException: Too many total edges were removed: 1
879, all edges:2235
        at com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.keepLarg
eNetworks(PrepareRoutingSubnetworks.java:182)
        at com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.doWork(P
repareRoutingSubnetworks.java:83)
        at com.graphhopper.GraphHopper.cleanUp(GraphHopper.java:1194)
        at de.geofabrik.railway_routing.RailwayHopper.cleanUp(RailwayHopper.java
:72)
        at com.graphhopper.GraphHopper.process(GraphHopper.java:649)
        at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:619)
        at com.graphhopper.http.GraphHopperModule$3.start(GraphHopperModule.java
:182)
        at com.graphhopper.http.GHServer.start(GHServer.java:118)
        at de.geofabrik.railway_routing.RailwayRoutingMain.web(RailwayRoutingMai
n.java:167)
        ... 2 more

my bat file:
java -Xmx1000m -Xms500m -Dlog4j2.configurationFile=logging.xml -jar railway_routing-0.0.1-SNAPSHOT-with-dep.jar action=web graph.location=graph-cache datareader.file=lithuania-latest.osm.pbf jetty.port=8989 jetty.resourcebase=webapp vehicle=rail

Error running the server web front-end

When I try to run the web front-end via

java -Xmx2500m -Xms50m -Dgraphhopper.prepare.ch.weightings=no   -Dgraphhopper.datareader.file=graphhopper/europe_germany_berlin.pbf -Dgraphhopper.profiles=freight_diesel   -jar target/railway_routing-0.0.1-SNAPSHOT-jar-with-dependencies.jar server

I get the error:

   Unrecognized field at: assets.resourcePathToUriMappings
    Did you mean?:
      - mappings
      - overrides
      - cacheSpec
      - mimeTypes
      - cacheControlHeader

I can run GraphHopper from the graphhopper subdirectory just fine using the Berlin PBF file.

Webinterface not working: Loading failed for the <script> with source “http://localhost:8989/maps/js/main.js?v=0.11.2”.

Hi,

I installed and configured OpenRailRouting according to the readme file.
The call http://localhost:8989/ is routed to http://localhost:8989/maps/, but the display of the web form is incomplete.
The error of the web console is: "Loading failed for the <script> with source “http://localhost:8989/maps/js/main.js?v=0.11.2”."
But no file named "main.js" is to be found in the entire directory structure.
Any ideas, how to get the web interface to work?
Schnappschuss (2020-07-08 23 19 07)

Cannot traverse short 0V isolation sections between high-speed and conventional lines

OpenRailRouting cannot traverse short 0V "isolation sections". These are marked on OSM in places like The Netherlands, between the transfer from high-speed to conventional. One example is near Hoofddorp. see image

I am not knowledgeable enough to implement a solution, however I suppose a condition could be imposed in the route finding to account for momentum. So incorrect electrification wouldn't be excluded instantly, only once a certain distance has elapsed from the last compatible electrification section.

It is important to note that these sections (at least in NL) still have the electrified:contact_line tag, but both voltage and frequency are set to 0. So another potential solution could be a checkbox to specify whether electrified, but 0V sections should be included as if they were normally electrified

Map UI not working?

Hi,

it seems that the Routing Map UI is not working. It just points to assets which contains a path where the UI is stored (graphhopper) but this is not going to work like this.
Is there a way how to make it work?

Regards
Stefan

PointNotFoundException - even point is valid

Hi all,

I tried to get some railroad tracks outside of Germany, e.g. from Munich to Moscow.
Therefore I use the planet-xxx.osm.pbf, but I receive a PointNotFoundException error, even the location exists.

I assume it is related to the distance, e.g.
Munich - Gdansk is found,
Munich - Riga ( farther away) throws the PointNotFoundException.
Munich - Marseille found.
Munich - Madrid (farther away) not found

Is there any distance limit or threshold to configure in Grasshopper or OpenRailRouting to overcome this situation?
Any hints?
Johannes

ERROR [2020-07-10 13:26:23,586] com.graphhopper.resources.RouteResource: point=48.137108%2C11.575382&point=55.750446%2C37.617494&type=json&locale=en-US&vehicle=freight_diesel&weighting=fastest&elevation=false&key= 127.0.0.1 en_US Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Firefox/78.0 [48.137108,11.575382, 55.750446,37.617494], took:0.013820671, , fastest, freight_diesel, errors:[com.graphhopper.util.exceptions.PointNotFoundException: Cannot find point 1: 55.750446,37.617494]
INFO [2020-07-10 13:26:23,586] com.graphhopper.http.MultiExceptionMapper: bad request: unknown reason

--gpx-location with wildcard does not work

Using a wildcard seems to not work at all. Each matching file isn't handled individually, and instead an empty result file "*.gpx.res.gpx" is produced after erroring.

$ java -Xmx2500m -Xms50m \
     -Dgraphhopper.prepare.ch.weightings=no \
     -Dgraphhopper.datareader.file="$OSMFILE" \
     -Dgraphhopper.graph.location="$GRAPH_CACHE"\
     -jar target/railway_routing-0.0.1-SNAPSHOT-jar-with-dependencies.jar \
     match --vehicle=alltracks --gpx-location=/tmp/samples/*.gpx $CONFIG_FILE
sample3.gpx
sample2.gpx
sample1.gpx
not_a_match
finished walking
/tmp/samples/*.gpx
	matches:	760
	gpx length:	2890607.408276032 vs 1286177.5047856877
	gpx time:	180434.0 vs 54403.23
	export results to:/tmp/samples/*.gpx.res.gpx
/tmp/samples/*.gpx
	matches:	0
	gpx length:	768085.0628084283 vs 0.0
	gpx time:	42424.0 vs 0.0
	export results to:/tmp/samples/*.gpx.res.gpx
java.lang.RuntimeException: You cannot call getInstructions if response contains errors. Check this with ghResponse.hasErrors(). Errors are: [com.graphhopper.util.exceptions.ConnectionNotFoundException: Connection between locations not found]
	at com.graphhopper.PathWrapper.check(PathWrapper.java:281)
	at com.graphhopper.PathWrapper.getInstructions(PathWrapper.java:224)
	at de.geofabrik.railway_routing.http.RailwayMatchCommand.run(RailwayMatchCommand.java:151)
	at de.geofabrik.railway_routing.http.RailwayMatchCommand.run(RailwayMatchCommand.java:46)
	at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
	at io.dropwizard.cli.Cli.run(Cli.java:78)
	at io.dropwizard.Application.run(Application.java:93)
	at de.geofabrik.railway_routing.http.RailwayRoutingApplication.main(RailwayRoutingApplication.java:34)
 $ ls /tmp/samples 
*.gpx.res.gpx not_a_match   sample1.gpx   sample2.gpx   sample3.gpx
$ cat /tmp/samples/\*.gpx.res.gpx 
$

Map-matching on metro or subways

Hi,
I'm working on a personal project that involves tracking public transport and I'm trying to do map matching on OSM using your library. I've successfully managed to use the low level API calling them from command line and they work fine for trains, problem is that I'd like to do the same thing, but on trams, metro and subways. I've delved into the "FlagEncoders" and "RailFlagEncoders" and I think I've understood how they work, I'd like to implement a new one to include other means of transport on rail. Unfortunately I can't figure out how to specify the type of "way" (https://wiki.openstreetmap.org/wiki/Map_Features#Railway) to be used to perform the matching.
Please feel free to ask any question if I haven't been clear enough,
Thanks for the help.

EDIT: grammar

Match command does not work due to missing "instructions"

Trying to run the match command does not work, due to an apparently unset "instructions" field:

java -Xmx2500m -Xms50m \ -Dgraphhopper.prepare.ch.weightings=no \ -Dgraphhopper.datareader.file="$OSMFILE" \ -Dgraphhopper.graph.location="$GRAPH_CACHE"\ -jar target/railway_routing-0.0.1-SNAPSHOT-jar-with-dependencies.jar \ match --vehicle=alltracks --gps-accuracy=40.0 --gpx-location="${GPX}" $CONFIG_FILE

Results in this error:

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2 WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.fasterxml.jackson.module.afterburner.util.MyClassLoader (file:/Users/matt/src/OpenRailRouting/target/railway_routing-0.0.1-SNAPSHOT-jar-with-dependencies.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.module.afterburner.util.MyClassLoader WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2 java.lang.NullPointerException at com.graphhopper.util.Helper.getLocale(Helper.java:53) at de.geofabrik.railway_routing.http.RailwayMatchCommand.run(RailwayMatchCommand.java:123) at de.geofabrik.railway_routing.http.RailwayMatchCommand.run(RailwayMatchCommand.java:46) at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87) at io.dropwizard.cli.Cli.run(Cli.java:78) at io.dropwizard.Application.run(Application.java:93) at de.geofabrik.railway_routing.http.RailwayRoutingApplication.main(RailwayRoutingApplication.java:34)

I'm able to make some progress by hacking this out (I'm unsure what withRoute is supposed to do):

diff --git a/src/main/java/de/geofabrik/railway_routing/http/RailwayMatchCommand.java b/src/main/java/de/geofabrik/railway_routing/http/RailwayMatchCommand.java
index d35036e..bfc7c4d 100644
--- a/src/main/java/de/geofabrik/railway_routing/http/RailwayMatchCommand.java
+++ b/src/main/java/de/geofabrik/railway_routing/http/RailwayMatchCommand.java
@@ -120,8 +120,9 @@ public class RailwayMatchCommand extends ConfiguredCommand<RailwayRoutingServerC
             throw new IllegalArgumentException("No input file was given. Please use the option gpx.location=*.");
         }
         int lastSeparator = PatternMatching.patternSplitDirFile(inputPath);
-        Translation tr = new TranslationMap().doImport().getWithFallBack(Helper.getLocale(namespace.getString("instructions")));
-        final boolean withRoute = !namespace.getString("instructions").isEmpty();
+        Translation tr = new TranslationMap().doImport().getWithFallBack(Helper.getLocale("en"));
+        //final boolean withRoute = !namespace.getString("instructions").isEmpty();
+        final boolean withRoute = false;
         LinkedList<Path> files = PatternMatching.getFileList(inputPath, lastSeparator);
         XmlMapper xmlMapper = new XmlMapper();

RuntimeException while parsing file, if not using freight_diesel

Hi, if I start the server with -Dgraphhopper.profiles=freight_diesel, everything works as expected.

But if I want to use a different profile, e.g. any of freight_electric_15kvac_25kvac, freight_diesel,tgv_15kvac25kvac1.5kvdc,tgv_25kvac1.5kvdc3kvdc, then the server reports a runtime exception, while parsing the osm file.

Before starting the server, I deleted already old caches in the graph-cache directory. The OSM file germany-latest.osm.pbf is unmodified, as downloaded from geofabrik.

So, how can I get the other profiles (e.g. freight_electric_15kvac_25kvac) to work?

BR Johannes

! at io.dropwizard.Application.run(Application.java:93)
! at de.geofabrik.railway_routing.http.RailwayRoutingApplication.main(RailwayRoutingApplication.java:34)
java.lang.RuntimeException: Problem while parsing file
at com.graphhopper.reader.osm.OSMReader.preProcess(OSMReader.java:207)
at com.graphhopper.reader.osm.OSMReader.readGraph(OSMReader.java:148)
at de.geofabrik.railway_routing.RailwayHopper.importData(RailwayHopper.java:102)
at com.graphhopper.GraphHopper.process(GraphHopper.java:646)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:624)
at de.geofabrik.railway_routing.http.RailwayRoutingManaged.start(RailwayRoutingManaged.java:34)
at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
at org.eclipse.jetty.server.Server.start(Server.java:418)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:382)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:93)
at de.geofabrik.railway_routing.http.RailwayRoutingApplication.main(RailwayRoutingApplication.java:34)
Caused by: java.lang.NullPointerException
at de.geofabrik.railway_routing.RailFlagEncoder.hasCompatibleElectricity(RailFlagEncoder.java:150)
at de.geofabrik.railway_routing.RailFlagEncoder.getAccess(RailFlagEncoder.java:167)
at com.graphhopper.routing.util.EncodingManager.acceptWay(EncodingManager.java:446)
at com.graphhopper.reader.osm.OSMReader.filterWay(OSMReader.java:251)
at com.graphhopper.reader.osm.OSMReader.preProcess(OSMReader.java:175)
... 19 more

Installation on Windows

Happy now year!
I am trying to install on Windows, using cygwin. Here are the steps I took, based of the README for ORR and GraphHopper. Some errors crop up during installation:

  1. Git cloned GraphHopper and set OpenJDK - all ok
  2. Ran git submodule add https://github.com/geofabrik/OpenRailRouting.git, and git submodule update. Encountered the following error:
error: Server does not allow request for unadvertised object d7497886bbb91b3cbb3
48465b1bd7308f5141ee0
Fetched in submodule path 'graphhopper', but it did not contain d7497886bbb91b3c
bb348465b1bd7308f5141ee0. Direct fetching of that commit failed.
  1. I assumed it was not crucial so continued and ran bash build.sh. Encountered the error
: invalid option name: pipefail

When I remove this line I get a list of error messages

build.sh: line 3: cd: $'graphhopper\r': No such file or directory
build.sh: line 4: mvn: command not found
build.sh: line 5: cd: $'..\r': No such file or directory
build.sh: line 6: $'\r': command not found
build.sh: line 8: cd: $'map-matching\r': No such file or directory
build.sh: line 9: mvn: command not found
build.sh: line 10: cd: $'..\r': No such file or directory
build.sh: line 11: $'\r': command not found
build.sh: line 14: cd: $'graphhopper\r': No such file or directory
build.sh: line 15: mvn: command not found
build.sh: line 16: mvn: command not found
build.sh: line 20: mvn: command not found
build.sh: line 21: mvn: command not found
build.sh: line 22: mvn: command not found
build.sh: line 23: mvn: command not found
build.sh: line 24: mvn: command not found
build.sh: line 25: mvn: command not found
build.sh: line 26: cd: $'/home/admin/ORR\r/map-matching/\r': No such file or directory
build.sh: line 27: mvn: command not found
build.sh: line 28: mvn: command not found

I am pretty certain I have mvn installed as Graphhopper was working before trying to install OpenRailRouting. I am guessing the errors involving '\r' are a result of different encoding, but I don't know how to fix these.

Slightly at a loss at what to do, any ideas?

Frontend /maps 404 error

Hi,

I followed the README, imported a map and started the server. Everything works except the frontend (/maps). I get a 404 error when visiting that page. Am I missing something?

Regards

turn restrictions routing vs. map-matching

Hi,
is it possible that the map-matching algorithm does not take into account turn restrictions by angle (or not so much) like classic routing does?
Example (left - routing, right - map matching):
image
Coordinates: 49.40771320279669,11.04756832122803 to 49.39492941352145,11.053726673126222

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.