Graph after reading OSM is empty

I started the service using graphoper-web-5.3.jar and the configuration file as well as the OSM map.
After reading the OSM file, it displays: java.lang.runtimeexception: graph after reading OSM must not be empty.

I also noticed a line: c.g.reader.osm WaySegmentParser - pass1 - finished, processed ways: 1? 963, accepted ways: 0, way nodes: 0, relations: -1, totalMB:227, usedMB:94

Does it mean that osmreader filters out all the roads when reading the map?

My OSM map is converted from the SHP file using josm. There is only one Provincial Expressway Network structure, and the OSM file can be opened normally in josm

GraphHopper only considers certain ways which depends on the vehicles used in your config file. For example if you only use one profile with vehicle: car only those OSM ways accepted by the CarFlagEncoder (in 5.3) will be considered. Whether a way is accepted depends on its tags and the by far most important one is the highway tag. My guess is that your OSM ways are missing such a highway tag. Maybe try setting highway=secondary for all your OSM ways and try importing the data again.

Do you mean to modify the way tag in the OSM file?

In the original OSM file, the label of way is as follows:

<way id='-105575' action='modified'>
 <nd ref='-1621219' />
 <nd ref='-1621237' />
 <tag k='traffic' v='11430.0' />
 <tag k='name' v='G346' />
</way>

I now change it to:

<way id='-105575' highway='secondary'>
 <nd ref='-1621219' />
 <nd ref='-1621237' />
 <tag k='traffic' v='11430.0' />
 <tag k='name' v='G346' />
</way>

Still useless

Yes, of course. If you feed non-standard OSM data (without highway tags for roads) what do you expect GraphHopper to do?

You need to add the highway like an OSM tag, not as an attribute of the way element as you did. For example:

<way id="123">
  <nd ref="1"/>
  <nd ref="2"/>
  <nd ref="3"/>
  <tag k="highway" v="secondary"/>
 </way>

Your next problem might be the negative way and node IDs you are using, I’m not sure how this is going to work out.

Thank you very much! After modification, I can read the OSM file.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.