I am new to graphhopper and osm maps.
The problem I am facing is a problem with wrong boundary box in graphhopper when I work with osm map.
I don’t entirely understand who is settings bbox when I import osm map, but according to graphhopper logs:
c.g.reader.osm.GraphHopperOSM - graph CH|car,foot|RAM_STORE ... bounds:0.09002685748100707,0.10008011236965908,0.24673715785303318,0.25557596807724164
c.g.http.GraphHopperManaged - loaded graph at:/data/slaskie-latest.osm-gh, data_reader_file:/data/slaskie-latest.osm.pbf, encoded ... bounds:0.09002685748100707,0.10008011236965908,0.24673715785303318,0.25557596807724164
I assume that during graphhopper start two configs are loaded -> graphhoppers, and osms. I don’t understand why do they have exactly the same
In effect I have got centered view on the Athlantic Ocean with
what (of course) is not my working area. I don’t know exactly where the problem might be placed. I was wondering to (somehow) override custom graphhopper config to set whole world as a working area (bbox= -180, 180, -90, 90).
Can anyone hava an idea where problem might be?
One more small question, and I’m sorry in advance if that would be stupid but everyone write about
config.yml file, but in the official repository there is
config-example.yml. Is is just a forum ‘jargon’ to talk about
config-example as a simple
config file or I need to somehow create
config.yml file in project structure?
Thank you in advance for any advice.
There is no bounding box setting in GraphHopper. GraphHopper derives the bounding box from the OSM file. If that does not work, maybe its because you processed your OSM file in some way and the bounding box got lost or corrupted? Did you try some OSM file from Geofabrik and did you have problems with this?
config.yml usually is the name of the config file used for GraphHopper. But the name does not really matter. It just needs to be passed to GraphHopperApplication correctly, see the documentation here: https://github.com/graphhopper/graphhopper#installation where
config-example.yml is used.
I use map which is generated by Osmosis -> merge method. There is no parameters for this method to respect/set boundary boxes. Probably it has got corrupted some way. I know it’s not perfect solution, but maybe I could say graphopper to use world wide boundary box (whole globe)?
Thanks for response
Which osmosis command did you use exactly? I just did this the other day and there was a boundary box in the resulting osm file:
I used something like this:
osmosis --read-pbf file="germany.osm.pbf" --bounding-box top=52.5187 bottom=52.5168737 right=13.4438002 left=13.4417939186 --write-xml file="extract.osm"
The first three lines of the resulting OSM file (note the bounds):
<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="Osmosis 0.48.3">
<bounds minlon="13.44179" minlat="52.51687" maxlon="13.44380" maxlat="52.51870" origin="0.46"/>
I can divide my process in two steps:
Read edited values from local editor:
osmosis --read-apidb host=$DBHOST database=$DBNAME user=$DBUSER password=$DBPASSWORD validateSchemaVersion=no --log-progress --write-pbf file=$EDITED_PBF_NAME omitmetadata=false granularity=20000
Merge my edited map with official OSM map:
osmosis --read-pbf file=$ORIGIN_PBF_NAME --sort --read-pbf file=$EDITED_PBF_NAME --sort --merge conflictResolutionMethod=lastSource --write-pbf file=$FINAL_PBF_NAME
I have checked maps on every steps by reading to graphhopper:
- reading map from editor and saving to
$EDITED_PBF_NAME generates correct boundary box.
- downloaded map from geofabrik also has correct boundary box,
- merge result
$FINAL_PBF_NAME has got wrong boundary box
I didn’t find any merge parameters to manipulate
bbox so assume that it should works by default correctly.
Maybe stupid question but can you recommend me some tool to read OSM file as a XML (as you show the lines of file)?
Unfortunately I am not familiar with the osmosis merge command, but yeah maybe have a look at the OSM file to see if there is something suspicious. Osmosis can convert pbf to xml so you can open it with your texteditor:
osmosis --read-pbf file="your_file.pbf" --write-xml file="your_file.osm"
Okay I’ve checked my OSM file.
It looks like I may have a some problem with graphhopper itself, but I don’t know why. I will try to solve that and inform about results.
<osm version="0.6" generator="Osmosis 0.45">
<bounds minlon="-180.00000" minlat="-90.00000" maxlon="180.00000" maxlat="90.00000" origin="Osmosis 0.45"/>
As I answered here the problem with wrong set boundary box was caused by using
granularity parameter for saving pbf file with Osmosis.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.