map writer .map file generation problem

180 views
Skip to first unread message

Radek

unread,
Mar 12, 2013, 3:20:06 PM3/12/13
to mapsfo...@googlegroups.com
Hi Guys,

I'm new to mapsforge development. Currently i'm trying to use mapsforge-writer plugin for Osmosis to generate .map from .osm file produced from ESRI shape file .shp.
OSM file that I'm trying to convert has been generated from .shp file by Merkaartor 0.18.1 (at the beginning I've tried to use JOSM for conversion, but I've found out that files produced by this program are not fully compatible with 0.6 spec - https://groups.google.com/forum/#!topic/mapsforge-dev/NF6V9CGjrhY/discussion, and Osmosis has problems with parsing it).

Conversion process that I tried:

1. .SHP file imported to Merkaartor 0.18.1
2. .OSM file exported from  Merkaartor 0.18.1 (from .SHP imported in 1.)
3.  Sort operation by osmosis-0.40.1 with command: osmosis --rx file="d:\bounds.osm" --sort --wx file="d:\bounds_sorted"
4.  Converted to .map file osmosis --read-xml file="d:\bounds_sorted.osm" --mw file="d:\bounds_sorted.map" bbox=51.69529,19.33785,51.84618,19.62886


Output from Osmosis is as follows:

osmosis --read-xml file="d:\bounds_sorted.osm" --mw file="d:\bounds_sorted.map" bbox=51.69529,19.33785,51.84618,19.62886
mar 12, 2013 9:45:44 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
mar 12, 2013 9:45:44 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
mar 12, 2013 9:45:44 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask <init
>
INFO: mapfile-writer version: mapsforge-map-writer-0.3.0
mar 12, 2013 9:45:44 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask <init
>
INFO: mapfile format specification version: 3
mar 12, 2013 9:45:44 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
mar 12, 2013 9:45:44 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
mar 12, 2013 9:45:45 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask proce
ss
INFO: start reading data...
mar 12, 2013 9:45:45 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask compl
ete
INFO: completing read...
mar 12, 2013 9:45:45 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask compl
ete
INFO: start writing file...
mar 12, 2013 9:45:45 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask compl
ete
INFO: overwriting file d:\bounds_sorted.map
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 100% of sub file for zoom interval index 0
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 100% of sub file for zoom interval index 1
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 10.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 20.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 30.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 40.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 50.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 60.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 70.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 80.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
INFO: written 90.0% of sub file for zoom interval index 2
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.MapFileWriter writeFile
INFO: Finished writing file.
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask compl
ete
INFO: finished...
mar 12, 2013 9:45:46 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask compl
ete
INFO: estimated memory consumption: 77,93MB
mar 12, 2013 9:45:46 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.
mar 12, 2013 9:45:46 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 2655 milliseconds.


I've also tried writing .osm to .pbf format first, and with no success. 
As you can see there are no problems during generation (at least not "visible" from console output). Unfortunately generated .map file seems to be corrupted - it has very small size, and after trying to display it with mapsforge there is blank white screen. I've read that this could be caused by defining wrong bounding box parameter but I think the one I pass is OK. Furthermore I’m certain that map-writer-plugin with Osmosis on my environment (Windows 7) works as I've tried to generate .map file from .osm data extracted from openstreetmaps.org page with success.
I think that the problem is rather in my OSM file (I have no idea what) - I've included its simplified version in this post with output .map file. Can anyone please take a look at it - maybe someone will point me what I'm doing wrong? Or what is wrong with my .osm file.

Thanks in advance.
bounds.7z

Ludwig

unread,
Mar 12, 2013, 6:19:40 PM3/12/13
to mapsfo...@googlegroups.com

I cannot look at your file right now,but i think your problem are negative ids in the osm file, which osmosis just drops.

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Radek

unread,
Mar 13, 2013, 4:37:38 AM3/13/13
to mapsfo...@googlegroups.com
Thanks Ludwig for quick reply - I'll try to to parse the file to make ID's positive and report the results.

Cheers

Radek

unread,
Mar 13, 2013, 8:12:36 AM3/13/13
to mapsfo...@googlegroups.com
Hi,

Unfortunately, changing ID's to positive does not resolve the problem. Still same effect - corrupted .map file.
Fixed .osm file is included to this post. Any other ideas?


Thanks in advance
bounds_sorted_positive_ids.7z

emux

unread,
Mar 13, 2013, 11:40:48 AM3/13/13
to mapsfo...@googlegroups.com
I have no problems with negative ids and also use the sort option. With osmosis 0.40.1 something like that:
osmosis --rx file=country.osm --s --mw file=country.map type=hd bbox=minLat,minLon,maxLat,maxLon tag-conf-file=tag-mapping.xml

I see you don't use custom tag mapping but the default one.
Maybe the tags in your shp/osm file do not correspond to the ones in the default tag mapping file so the produced map is empty?

Radek

unread,
Mar 13, 2013, 12:19:45 PM3/13/13
to mapsfo...@googlegroups.com
Thank you for your advice emux. 
Untill now I've somehow put no attention to tag-mapping file. I'will get a good look at it - your hint sounds reasonable. I'll report the results

Cheers

Neil Boyd

unread,
Mar 13, 2013, 12:25:12 PM3/13/13
to mapsfo...@googlegroups.com
I use negative ids for data that I merge using osmosis and they work just fine.

Neil

Radek

unread,
Mar 14, 2013, 9:32:16 AM3/14/13
to mapsfo...@googlegroups.com
Yup,that was it. 
Many thanks for your advice emux!


W dniu środa, 13 marca 2013 16:40:48 UTC+1 użytkownik emux napisał:
Reply all
Reply to author
Forward
0 new messages