Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I successfully created a (.osm) set suitable for routing in a desktop GIS over a large custom area thus keeping only primary network (way object) using the Overpass API (see below).

I'm trying this approach because my study area is crossing national and local borders, so other approach to parse a full planet file might take a lot of resources... which I don't have...

However the resulting OSM XML was rejected by osm2po because the file tr_raw.2po is missing after the first reading phase (see log below).

Is there a way to produce through Overpass API a suitable file (but not too heavy!) to use along with osm2po?

Or can we modify osm2po behavior to work without relations so no error is thrown?

Thanks and sorry for my poor English ;)

Here is the overpass request:

<osm-script>
  <query type="way">
    <has-kv k="highway" regv="junction|motorway|motorway_junction|motorway_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|trunk|trunk_link"/>
    <bbox-query e="8.1024169921875" n="48.34529727896014" s="47.331377157798244" w="6.8060302734375"/>
  </query>
  <union>
    <item/>
    <recurse type="down"/>
  </union>
  <print/>
</osm-script>

And here is the log:

LOG    Opened at Thu Apr 25 11:59:14 CEST 2013
INFO   Running osm2po 4.7.7 with cmd=tjsp
       SingleTileMode Uncompressed - 1 359M
INFO   Starting Tiler at Thu Apr 25 11:59:14 CEST 2013
INFO   Reading from
       mypath\extract.osm
INFO   Using parser de.cm.osm2po.converter.OsmXmlParser
INFO   166 865 of 166 865 nodes extracted - 1 354M
INFO   0 of 0 relations extracted - 1 354M
DEBUG  Writing TileFile:tm_info.2po
DEBUG  Prefix:extract Ways:0 Relations:0
       Tiles[1] SingleTileMode
       [0] Id:0 (s090-w180) Coords:166 520 Complex:345
INFO   Tiler finished at Thu Apr 25 11:59:16 CEST 2013
INFO   Starting Joiner at Thu Apr 25 11:59:16 CEST 2013
DEBUG  Reading TileFile tm_info.2po
DEBUG  Prefix:extract Ways:0 Relations:0
       Tiles[1] SingleTileMode
       [0] Id:0 (s090-w180) Coords:166 520 Complex:345
DEBUG  Capacity for Shared Ids is 3
INFO   Caching relations from tr_raw.2po - 1 358M
FATAL  Exception at Thu Apr 25 11:59:16 CEST 2013
       Message: java.io.FileNotFoundException: extract\tr_raw.2po (Le fichier spécifié est introuvable)
       Class: java.lang.RuntimeException
       Stacktrace:
       de.cm.osm2po.primitives.InStreamDisk.<init>(InStreamDisk.java:30)
       de.cm.osm2po.converter.Joiner.cacheOsmRelations(Joiner.java:106)
       de.cm.osm2po.converter.Joiner.run(Joiner.java:171)
       de.cm.osm2po.Main.runJoiner(Main.java:191)
       de.cm.osm2po.Main.main(Main.java:126)
INFO   ------------------------------------------------------------------

       For more help enter
       java -jar osm2po-core-4.7.7-signed.jar -h


LOG    Closed at Thu Apr 25 11:59:16 CEST 2013
share|improve this question
    
I got it to work but i can't answer to myself before 6 hours because my reputation is to low... what a shame, I will post correct syntax as soon as possible! –  Mhs Apr 25 '13 at 11:58

2 Answers 2

The log reports Prefix:extract Ways:0 Relations:0, so there must be sth. wrong. Don't ask me when, but in one of the prior versions I fixed the case where no relations exist. But a source without ways cannot be valid. It seems that your extract is not that big, so can you compress and send it to my email-addi?

Anyway, why don't you download france.osm.pbf? Even on an old computer with 1Gig RAM osm2po is able to translate it.

share|improve this answer
    
Thanks for your answer. But finally everything is alright. –  Mhs Apr 25 '13 at 18:49
    
I was using the Overpass API because I'm working on a cross border area so it thought it would be less painful to generate and parse an unique ohm file than to append 3 country file :P –  Mhs Apr 25 '13 at 18:52
    
But thank to your comment I might try again with smaller ways level on the same area. Even if limiting to majors road was also pertinent in my case use since I only need to trace multiple route from many town-halls (sources) to one Town-hall (target). Work don't need to be precise, and shouldn't because less roads are better for the final rendering in have in mind. –  Mhs Apr 25 '13 at 18:57
    
PS: I understand this reputation system is needed to avoid spam, but it's frustrating again that i can't validate my answer until 2 days :D –  Mhs Apr 25 '13 at 18:59
up vote 0 down vote accepted

Ok the answer was plain simple, the correct syntax for API Overpass is the following. You just have to add this line <recurse type="up"/> so that upper relations are also included.

<osm-script>
  <query type="way">
    <has-kv k="highway" regv="junction|motorway|motorway_junction|motorway_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|trunk|trunk_link"/>
    <bbox-query e="8.1024169921875" n="48.34529727896014" s="47.331377157798244" w="6.8060302734375"/>
  </query>
  <union>
    <item/>
    <recurse type="down"/>
    <recurse type="up"/>
  </union>
  <print/>
</osm-script>

I've tried it earlier and it failed, but this was due to an error by my side (wrong bbox coordinate after copy/past causing file to be too heavy).

This syntax work and I managed both to launch osm2po server and to copy the SQL to my Postgres/Postgis/PgRouting server. First test with PgRouting are concluding!

By the way thanks a lot to osm2po this program is pretty magical!

share|improve this answer
    
No, this time there's no magic. It's a simple bug I thought I have fixed a long time ago ;-) I've just debugged it and I guess your first region does not contain one restriction, the second one (maybe because it's bigger) does. –  Carsten Apr 25 '13 at 18:56
    
This is an issue which will be fixed in the next version. –  Carsten Apr 25 '13 at 19:02
    
Thanks a lot for your fast support! –  Mhs Apr 25 '13 at 19:06
    
I'll have to thank you. –  Carsten Apr 25 '13 at 19:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.