mkgmap creates bad mapset, when input files aren't sorted

Hi, following command produce good mapset for Mapsource:
mkgmap --code-page=1252 --route --index --bounds=bounds 29624847.osm.pbf 29624849.osm.pbf 29624850.osm.pbf
This command creates bad mapset:
mkgmap --code-page=1252 --route --index --bounds=bounds 29624849.osm.pbf 29624847.osm.pbf 29624850.osm.pbf
The only difference is changed order of input pbf files. Bad mapset crashes Mapsource, when trying to send map to GPS. Mapsource gives information about error in MDR_TRIM_ADDR.CXX, which suggest mapset index. I have compared output files for both compilation. Index *_mdr.img is very different. Additionally first and second img are different, while third is the same (except compilation time). I think that output img should be the same, regardless of compilation sequence. -- Best regards, Andrzej

Hi [ Sorry I released this from the moderation queue at almost exactly the same time as you resent it from your other address]
This command creates bad mapset:
mkgmap --code-page=1252 --route --index --bounds=bounds 29624849.osm.pbf 29624847.osm.pbf 29624850.osm.pbf
You are right, the files have to be sorted by the internal map id. I have some complex code that is meant to sort the mdr1 section and all the related sections but it sometimes or always doesn't actually work ;) (http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2015q1/023050.html) It would be better to sort the file arguments after the maps are created but before they are combined into the index. So I shall have a go at getting it to work finally. ..Steve

Hi Steve,
It would be better to sort the file arguments after the maps are created but before they are combined into the index.
Sorting arguments could be a good trick to bypass the problem. After finding the reason I have added sorting to my scripts and now it works OK. Differences in img files worry me a bit too. I can't see any negative consequences but it looks like compilation is state dependent, maybe some variables are not cleared at the start of new img? -- Best regards, Andrzej

Hi Andrzej
Differences in img files worry me a bit too. I can't see any negative consequences but it looks like compilation is state dependent, maybe some variables are not cleared at the start of new img?
Yes that is strange, they should not be different, apart from timestamps and if the order change causes different map-id's then there would be a few changes then. Are you using --max-jobs? If so try without, it shouldn't make any difference but there may be a bug. ..Steve

Hi Steve,
Are you using --max-jobs?
I have reduced problem to 3 files and then executed mkgmap with options like in my first post, no max-jobs. Now I have tried with max-jobs=8 and still have gotten differences in one file, second on the list this time. TDB contains tiles in the same order as in options. Maybe it is not a problem, but probably better sort them for TDB too. -- Best regards, Andrzej

Hi Andrzej
Sorting arguments could be a good trick to bypass the problem. After finding the reason I have added sorting to my scripts and now it works OK.
I've created a patch (attached) that does the sorting. It will need some testing. I removed all the old code that attempted to fix up the sections after they had been created. It does seem that it was that code that caused the map source crashes. Jar file at: http://files.mkgmap.org.uk/download/294/mkgmap.jar
Differences in img files worry me a bit too. I can't see any negative consequences but it looks like compilation is state dependent, maybe some variables are not cleared at the start of new img?
This is harmless, files can always be different unless you give the --preserve-element-order option. A quick test shows no differences for me if that option is given. Cheers, ..Steve

Hi Steve,
I've created a patch (attached) that does the sorting. It will need some testing.
Thanks! I have checked, that patch corrects problem with Mapsource crashing when sending map to GPS. I have also verified, that resulting *_mdr.img is independent of input files order. Address search works in Mapsource, but I haven't done any more testing. -- Best regards, Andrzej

Thanks I shall commit in a couple of days, if no one reports any problems.
I've created a patch (attached) that does the sorting. It will need some testing.
Thanks! I have checked, that patch corrects problem with Mapsource crashing when sending map to GPS. I have also verified, that resulting *_mdr.img is independent of input files order.
Address search works in Mapsource, but I haven't done any more testing.
participants (2)
-
popej
-
Steve Ratcliffe