Creating boundary files

Hi,

I want to create boundary files for Kabul map downloaded from Openstreetmap.org in .osm format for Garmin Mobile XT.

I have downloaded Mkgmap(latest version), osmconvert and osmfilter and also map of Kabul city, and because map of Kabul city is only 10MB there for I don’t divide and split it to small regions.

Now when I want to create boundary files and type following commands in cmd I get errors,

when I type osmconvert kabul.osm --out-o5m >kabul.o5m

I get errors,

osmconvert Warning: wrong sequence at way 28614055
osmconvert Warning: next object is way 28612513
osmconvert Warning: wrong sequence at way 69825386
osmconvert Warning: next object is way 23841288
osmconvert Warning: wrong sequence at way 42472052
osmconvert Warning: next object is way 4398580

But the kabul.o5m file is created with 705KB size.

when I type osmfilter kabul.o5m --keep-nodes= --keep-ways-relations=“boundary=administrative =postal_code postal_code=” >kabul-boundaries.osm

I get errors,

osmfilter Warning: wrong sequence at way 28612513
osmfilter Warning: wrong sequence at way 23841288
osmfilter Warning: wrong sequence at way 4398580

But kabul-boundaries.osm is created with 13KB size.

When I type java -jar mkgmap.jar --createboundsfile=kabul-boundaries.osm

I get error,

SEVERE (BoundarySaver): Calculate bbox to (46079.99997854233,46079.99997854233)
to (-46080.0,-46080.0)
Exception in thread “main” java.lang.NullPointerException
at uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryPreparer.workoutBou
ndaryRelations(BoundaryPreparer.java:141)
at uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryPreparer.run(Bounda
ryPreparer.java:110)
at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:333)
at uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.ja
va:126)
at uk.me.parabola.mkgmap.main.Main.main(Main.java:112)

and no bounds directory is created.

Therefor when I change the map from .osm to .img and use it Garmin Mobile XT I can’t search for addresses.

What is your recommendations what should I do to create boundary files for Kabul map and use it Garmin Mobile XT

Hi,

how did you download the osm data for Kabul? When you use JOSM for it, some relations may not be completely downloaded. Make sure to download all relations manually completely.

HTH,
ajoessen

Thanks for your reply.

I have downloaded the map for Kabul from openstreetmap.org and selecting Export and XML option. I wanted to download Afghanistan map but it wasn’t possible to download larg area then I downloaded only kabul.

And I am somehow new to creating maps, can you add some information on downloading all the relations?

Thank you.

Ok, I did it the same way now, and opened the osm-file with our editor JOSM. If you dont have it already open, press alt+shift+R to open the relation editor.
There you see the entry border[2] “Afghanistan” (incomplete). Right-click on that entry and select download incomplete elements.

Next step is downloading the province borders. Press the download icon (the third one from the left), and look for the point, where the provinces of Kabul, Parwan and Wardak join together, just a bit west from the city. Select a small area around that point, and you get the relations of the three provinces. Repeat the step of border[2] above for the three provinces.

I just found that the border relation for Kabul province is not a closed ring. You have to fix and upload that to get adress search working.

Save the result and try again osmfilter and mkgmap.

HTH,
ajoessen

Thank you sir, I will try that and will reply with the status.

Ok, I have downloaded all the relations and got a 12.1 MB Kabul. And also has successfully created boundary files.
But when I type:

*java -jar mkgmap.jar --route --remove-short-arcs --add-pois-to-areas --index --gmapsupp .osm

I get this error:

Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at uk.me.parabola.imgfmt.app.mdr.Mdr29.preWriteImpl(Mdr29.java:62)
at uk.me.parabola.imgfmt.app.mdr.MdrSection.preWrite(MdrSection.java:138
)
at uk.me.parabola.imgfmt.app.mdr.MDRFile.writeSection(MDRFile.java:379)
at uk.me.parabola.imgfmt.app.mdr.MDRFile.writeSections(MDRFile.java:353)

** at uk.me.parabola.imgfmt.app.mdr.MDRFile.write(MDRFile.java:247)
at uk.me.parabola.mkgmap.combiners.MdrBuilder.onFinishForDevice(MdrBuild
er.java:382)
at uk.me.parabola.mkgmap.combiners.GmapsuppBuilder.onFinish(GmapsuppBuil
der.java:116)
at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:417)
at uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.ja
va:126)
at uk.me.parabola.mkgmap.main.Main.main(Main.java:112)**

And also no gmapsupp.img file.

What to do next?

And after fixing these will I get address search working or as you said I should first fix the border relation issue for Kabul?

Thanks,

Have you tried without --index? just to see if the rest of mkgmap works fine.

Ofcourse you have to close the border relations first. Its not just Kabul province, but also a few other east of the City. Borders that are not closed are useless for the adress index.

Another trial: If boundaries dont work, you can use other options for adress index:
–location-autofill=nearest
or
–location-autofill=is_in
or both:
–location-autofill=is_in,nearest

HTH,
ajoessen

I have tried that without --index but what I get is only 16 KB gmapsupp.img file.
After that I have download a new map of Kabul from openstreetmap.org using Export and XML option and for that every thing (without --index) worked fine.

Seems that problem is only with the file I have edited with JOSM.

Ok, I have fixed that problem. I have used the Splitter and splitted the map and tried creating gmapsupp.img file and worked fine.

Thanks for your help.

I would like to know one thing else.
I have a Topo map of Afghanistan for Garmin and is not routable, is there any way to make it routable?

If you own the contour data and also have OSM road data you can compile a routable topo with Mkgmap. If the contour map is compiled, and you don’t have access to the data your best option would be to download whatever Lambertus provides for Afghanistan and use that for routing. This works best if the contour map is transparent and doesn’t show roads. Otherwise, if road data is not from OSM there could be some graphical conflicts.

The topo map is a Mapsource unlocked folder downloaded from:

http://www.netload.in/dateiKnv7Xn4OgM/1040_afg_zopv2.part3.rar.htm

http://www.netload.in/dateiec4StkO42k/1040_afg_zopv2.part4.rar.htm

http://www.netload.in/dateihnvGpmImp3/1040_afg_zopv2.part5.rar.htm

http://www.netload.in/dateiNRKndagHRV/1040_afg_zopv2.part2.rar.htm

http://www.netload.in/dateiQgEICsKlWB/1040_afg_zopv2.part1.rar.htm

don’t know if it is able to compile it with OSM road map. If it is, can you say how I can do it.

Also please add some detail on how to create border relations.

I have closed the ring of Kabul by drawing nodes, but didn’t find what to select under “Presets”. Like other 3 members for Kabul has Board_type, Admin_level, boundary and id.
How can I add these to the border I create/add?

Best regards,

It’s not possible to use compiled IMG files to create maps.

Suggest you try here to generate contours. http://wiki.openstreetmap.org/wiki/Srtm2osm

Don’t know anything about relations.

Srtm2Osm is outdated, you should look instead at http://katze.tfiu.de/projects/phyghtmap/.

Thorsten

Good to know, thanks.