
Dear mailing list, let me introduce myself. Some might recognize my name. I am the main author of QLandkarte/QMapShack. I have quite some experience in decoding the Garmin formats. But little knowledge in encoding the format. My main focus is on raster maps rather than vector maps as they provide more details in alpine areas. Years ago I was in contact with Alex Whiter to decode and encode the Garmin Bird's Eye format that uses some kind of DRM. To make it work the DRM check on the devices had to be disabled. Alex provided a firmware patcher. That solution worked pretty well over the years. A couple of years ago we had another contact. This time it was decoding the raster maps embedded into the IMG format. At that time decoding was the goal. We never considered encoding the stuff as there is the JNX format as a much simpler solution. However life is not a constant and Alex died a couple of moons ago. See for details: https://www.gpspower.net/forum-announcements/359499-vale-alexwhiter.html And with him the knowledge about the firmware patcher. Right now it still works. But it's just a question of time that this will fail. Therefore I invested quite some days of spare time to consolidate my old decode code and to start encoding. Alex wrote some documentation in Russian and Wolfgang taking care of the QMapShack Wiki translated it into English: https://github.com/Maproom/qmapshack/wiki/RasterImg_AWhiter My current progress can be found here: https://github.com/kiozen/GarminImg Let me explain why I started to write my own encoder rather than diving into the code of mkgmap * I never wrote Java. And starting to learn Java with mkgmap is a bit frightening ;) Sorry :D * My target users are everyday Garmin users that do have raster maps but very little experience with map creation. Therefore I need a simple solution that can be shipped with QMapShack/QMapTools * All IMG files embedding raster maps that are available to me make use of the newer encoding via GMP part rather than the older format. I do not know if the last point is necessary. From my understanding it shouldn't matter. But as I am not sure I started with new newer format. The complete project reached the point, where I can create IMG files with a raster map embedded. And I can decode that map again. However - you surely guessed it - the device refuses to list the map. This is kind of expected. There are many details to get right and a single one can make it fail. Therefore I decided to reach out for help and inspiration contacting this list. My first question would be: What is the minimum data an IMG file has to contain to be listed on the device? Right now I try to create a file with more or less empty GMP section. From the comments in mkgmap I already learned that it needs at least two copyright strings. But does a map require to have points/lines and areas to be listed on the device? In other words: How can I make sure my header, FAT table and MPS section is ok? To have a map with no data listed on the device would be a huge step forward. Cheers Oliver

Hi Oliver, that's an interesting subject, you are working on. You probably know this free map, I think this is an example of required minimum: http://static.garmin.com/shared/aus/HTML/_pages/isle-of-man.html -- Best regards, Andrzej

Hi Andrzej yes this is the map that was used to get first information about the format. But it's still quite big and has a lot of stuff that's probably not related to the raster map layer. My question targets more to what is the minimum required to get a map listed on the device. Without any raster map etc. Is it ok to have sub files with no elements at all? Are there some elements required like the map boundary polygon? Is there the need of some other mandatory stuff that is not so obvious? Before I can concentrate on my raster map encoding I need something that works without. Cheers Oliver
Gesendet: Samstag, 02. Januar 2021 um 17:12 Uhr Von: "Andrzej Popowski" <popej@poczta.onet.pl> An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] Embedding raster maps
Hi Oliver,
that's an interesting subject, you are working on. You probably know this free map, I think this is an example of required minimum: http://static.garmin.com/shared/aus/HTML/_pages/isle-of-man.html
-- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Oliver
What is the minimum data an IMG file has to contain to be listed on the device?
Its an interesting question. I don't remember having too many problems getting a map recognised in the beginning. At r20 it worked according to the commit comment but I only added the test map builder at r24. However on my etrex 30 the map produced by r24 does not work. The first one that does work is r79. With a bit of experimenting I discovered that adding a sufficiently large gap between the end of the TRE header and the first data would make r78 work too. Going back to r24 and adding more padding also produced a map that was recognized. I was able to remove the second copyright message too and all map data. The required gap was between 40 and 101, depending on the rest of the code. So this all makes very little sense and it is possible that this is covering for something else that we don't understand. I've uploaded the minimal IMG file at: http://files.mkgmap.org.uk/download/494/gmapsupp.img (After this I also managed to remove the first copyright message, so you do not need any copyright messages and the label section can be empty) With this version there is no message displayed on startup, which is something that was fixed in r79 I think. There is just a single zoom and subdivision in the TRE section and no points, line or polygons. Cheers, Steve

Hi Steve, I tested your map. It's not listed either. I have a GPSMap64s and placed it into the internal as well as into the external memory. I removed all other maps on the device, except the basemap. The basemap is the only one listed. I made a minimum test.img, too. It contains no points, lines or areas. It has 3 zoom levels 22..24 with a sub-division each. I also uploaded a log from my test decoder. https://www.magentacloud.de/share/s429h1z-r6 I uploaded a second one with the version in the header set to 2. So far the difference to be another offset for the FAT. Maybe you can cross check if your device is willing to list them. Cheers, Oliver
Gesendet: Sonntag, 03. Januar 2021 um 23:08 Uhr Von: "Steve Ratcliffe" <steve@parabola.me.uk> An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] Embedding raster maps
Hi Oliver
What is the minimum data an IMG file has to contain to be listed on the device?
Its an interesting question. I don't remember having too many problems getting a map recognised in the beginning. At r20 it worked according to the commit comment but I only added the test map builder at r24.
However on my etrex 30 the map produced by r24 does not work.
The first one that does work is r79. With a bit of experimenting I discovered that adding a sufficiently large gap between the end of the TRE header and the first data would make r78 work too.
Going back to r24 and adding more padding also produced a map that was recognized. I was able to remove the second copyright message too and all map data.
The required gap was between 40 and 101, depending on the rest of the code.
So this all makes very little sense and it is possible that this is covering for something else that we don't understand.
I've uploaded the minimal IMG file at: http://files.mkgmap.org.uk/download/494/gmapsupp.img
(After this I also managed to remove the first copyright message, so you do not need any copyright messages and the label section can be empty)
With this version there is no message displayed on startup, which is something that was fixed in r79 I think.
There is just a single zoom and subdivision in the TRE section and no points, line or polygons.
Cheers, Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On 04/01/2021 13:07, Oliver Eichler wrote:
Hi Steve,
I tested your map. It's not listed either. I have a GPSMap64s and placed it into the internal as well as into the external memory.
Attempting to use the old code was probably a mistake, I've uploaded an empty map using a modern version of mkgmap: http://files.mkgmap.org.uk/detail/495 This is also in the proper gmapsupp format unlike the previous one.
I made a minimum test.img, too. It contains no points, lines or areas. It has 3 zoom levels 22..24 with a sub-division each. I also uploaded a log from my test decoder.
Maybe you can cross check if your device is willing to list them.
My etrex30 does not list either of them. Re-packing the GMP file into a gmapsupp using mkgmap did not get it listed either. I believe that the byte at 0x40 is the start block of the FAT so in test.img it should be 2. Patching that byte did not make it load though. Cheers, Steve

Hi Steve, that was really helpful. I managed to get my map listed. However the raster layer did not show up :( Well I didn't really expect it. ;)
I believe that the byte at 0x40 is the start block of the FAT so in test.img it should be 2. Patching that byte did not make it load though.
Indeed, it seems to be an offset in number of 0x200 blocks. In all my example maps it's set to 8 and FAT starts at 0x1000. In your map it's set to 2 and FAT starts at 0x400. Another mystery solved. I guess the next step is to get a rectangular extended polygon without the raster data to show up. The polygon type for the raster map tiles used is 0x10613. Usually it only contains a single point as the extended data referencing the jpeg tile has the four boundaries coded as 32 bit integers. My goal is to remove the extended data and to code all 4 corner coordinates. This should give me a matrix of all rectangles. Again this raises the question about the minimum effort necessary to add a single polygon. In my naive point of view it would be just encoding it into the extended polygon section of the RGN file. Of course I tried it and it does not work. So I am missing something, or have a couple of more bugs in my code. Would it be possible to code another file with a single polygon QPolygonF( QPointF(11.7914,46.9628) QPointF(11.8021,46.9628) QPointF(11.8021,46.9555) QPointF(11.7914,46.9555) ) coded in three map levels: 0/24bit, 1/23bit and 2/22bit. This would give me a nice working reference to compare. Thanks & Cheers Oliver
participants (3)
-
Andrzej Popowski
-
Oliver Eichler
-
Steve Ratcliffe