abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
494 stars 117 forks source link

Generating segments by process_pbf_planet.sh fails #691

Open MarekSven opened 5 months ago

MarekSven commented 5 months ago

Hi all,

I was trying to generate my own segments with just a subset of elements so that the size of segments is smaller.

For my initial attempts I downloaded a map of Germany from https://download.geofabrik.de/ and run the script with this.

Running the script fails with: Exception occurred: we need one lat/lon point at least!

Inspecting the code a bit it seems to me that it has to fail on the following lines of the script: ${JAVA} -jar ${BROUTER_JAR} segments 16.917636 51.040949 seed 0 ${BROUTER_PROFILES}/car-traffic_analysis.brf

Lat and lon are provided as arg[2] and arg[3] with this line, while BRouter.java expectes a pair of lat and lon as a single arg[4]. Maybe I am missing something but I do not have a clue how this could ever work?

What is a purpose of those lines with car-traffic_analysis.brf?

Nevertheless, at the time of failure, after all the way-cutting, node-cutting and way-linking, all the generated subdirectories of the ./tmp directory are empty, with the exception of ./tmp/nodetiles.

noname09051989 commented 5 months ago

I am facing the same issue and just stumbled across this issue.

I tried to run the process_pbf_planet.sh directly in Ubuntu OS. Creating the fatJar worked fine. However, when running the segment creation process no segment files are generated.

Looking forward for a short feedback. :)

afischerdev commented 5 months ago

Please use only the short form;

...
JDBC="jdbc:postgresql://localhost/osm?user=postgres&password=xyz&ssl=false"

${JAVA} -cp ../postgresql-42.6.0.jar:../brouter.jar -Ddeletetmpfiles=true -DuseDenseMaps=true  btools.mapcreator.OsmFastCutter ../lookups.dat nodetiles waytiles nodes55 waytiles55  bordernids.dat  relations.dat  restrictions.dat  ../all.brf ../trekking.brf ../softaccess.brf ../planet-new.osm.pbf $(JDBC)

rm ../planet-latest.osm.pbf
mv ../planet-new.osm.pbf ../planet-latest.osm.pbf

mkdir unodes55
${JAVA} -cp ../brouter.jar -Ddeletetmpfiles=true -DuseDenseMaps=true btools.mapcreator.PosUnifier nodes55 unodes55 bordernids.dat bordernodes.dat /srtm3_bef

mkdir segments
${JAVA} -cp ../brouter.jar -DuseDenseMaps=true -DskipEncodingCheck=true btools.mapcreator.WayLinker unodes55 waytiles55 bordernodes.dat restrictions.dat ../lookups.dat ../all.brf segments rd5

...

The traffic is now done via the database generator, please see here and database generation

And yes, we need an update for the documention and the script.

MarekSven commented 5 months ago

Thank you for your reply. I am trying to continue based on the information on https://github.com/abrensch/brouter/blob/master/misc/scripts/mapcreation/readme_database.md.

As someone who has never used postgres on Linux, I would like to know what kind of command-line tool is "postgres". There seems to be just "psql". Typing "postgres" in bash fails, no matter what user I log in (sudo su) as. Ok, so assumed it is just a typo. I managed to create the "osm" db, granted access to it for my user "developer" in pgAdmin, launched the "import to database and create" command and got:

postgres@debian11:/home/developer/Dev/github/brouter/misc/scripts/mapcreation$ osm2pgsql -c -s -d osm -U developer -W -H localhost -P 5432 -O flex -S brouter_cfg.lua /home/developer/brouter/germany-latest.osm.pbf

2024-04-26 12:02:29  osm2pgsql version 1.4.1
Password:
2024-04-26 12:02:35  Database version: 13.14 (Debian 13.14-0+deb11u1)
2024-04-26 12:02:35  PostGIS version: 3.1
2024-04-26 12:02:35  Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=11
2024-04-26 12:02:35  node cache: stored: 83244(100.00%), storage efficiency: 47.69% (dense blocks: 1, sparse nodes: 83181), hit rate: 0.00%
2024-04-26 12:02:35  ERROR: Failed to execute Lua function 'osm2pgsql.process_node': brouter_cfg.lua:121: unknown field 'as_point'
stack traceback:
    [C]: in function 'error'
    [string "..."]:178: in metamethod '__index'
    brouter_cfg.lua:121: in function <brouter_cfg.lua:112>.
MarekSven commented 5 months ago

Ok, due to this: https://stackoverflow.com/questions/75687110/lua-config-throwing-error-in-metamethods , it seems a version 1.6.0 of osm2pgsql is required.

zod commented 5 months ago

For a first creation of segment data you can leave out the traffic estimations to get you started. @mjaschen also created a docker image which simplifies the creation of segment data.

I already have some ideas how we could simplify the creation and will create a PR soon.