Support for Garmin Custom Maps KMZ

424 views
Skip to first unread message

Gavin

unread,
Jan 5, 2012, 11:10:13 PM1/5/12
to Custom Maps users
Firstly... thanks Marko for making such a useful app available for
free! I've used it a number of times on bush trips with topo maps -
very useful.

I was wondering if you were thinking of extending the kmz support to
multi-image kmz files, much like the Garmin Custom Maps support?

Here's an example file: http://www.topomap.co.nz/kmz/CC11.kmz

I tried copying this to my Android (Sony Ericsson Xperia Mini in case
it's useful to know) and placing it in the Custom Maps folder. However
the app failed to notice it.

Cheers,
Gavin

Marko Teittinen

unread,
Jan 6, 2012, 3:07:37 PM1/6/12
to custom-m...@googlegroups.com
Actually, Custom Maps already supports multi-image kmz files, but the kmz file generated by Garmin Custom Maps seemed to have two extra bytes in the beginning of the doc.kml file included inside the kmz files. Those two prefix bytes prevent the file to be parsed by standard XML parser libraries, as the file is not valid XML. I will investigate if I can somehow detect this and ignore the first two bytes stored in Garmin generated files.

If you want a quick workaround for this issue, you could extract the "doc.kml" file from the kmz, open it in a text editor to remove the two prefix bytes (the default text editor on Mac removed the two bytes for me when I added and then removed a space in the beginning of the file before saving it), and then put it back into the kmz file (using standard zip tools). If you put the modified file to the Custom Maps folder on your Android device, you should be able to see and use all the maps. The option to modify/preview map fit will not be available though (the names of the maps may not be quite what you want).

If you want to rename the maps, you could do that while you are editing the doc.kml file removing the two leading characters from it.

I hope this helps.

Marko Teittinen


Gavin

--
You received this message because you are subscribed to the Google Groups "Custom Maps users" group.
To post to this group, send email to custom-m...@googlegroups.com.
To unsubscribe from this group, send email to custom-maps-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/custom-maps-users?hl=en.


Gavin

unread,
Jan 6, 2012, 7:46:49 PM1/6/12
to Custom Maps users
Hi Marko,

Thanks for getting back to me - much appreciated.

I edited the doc.kml file and replaced the file inside the kmz but
still no joy. This is using the example file mentioned above. There
didn't appear to be any extra bytes at the beginning. Any other ideas
why Custom Maps isn't seeing it? Perhaps it's because when all the
small individual jpgs are combined it will result in an image larger
than 3 megapixels in size?

Cheers,
Gavin

Marko Teittinen

unread,
Jan 6, 2012, 10:25:00 PM1/6/12
to custom-m...@googlegroups.com
Gavin,

The app really can handle the kmz without those extra bytes. I tested it myself. I have attached to this message a zip file containing a fixed version of the doc.kml that only has the prefix bytes removed. If you extract it from this message and put it into the kmz file replacing the old one, you should be able to see all the 54 map sections as separate maps in the "select map" list.

I did some more investigating and turned out that the prefix in that file is a UTF-8 encoded Byte Order Mark (BOM) character (U+FEFF). It is entirely unnecessary in UTF-8 files, but some editors (most notably Notepad in MS Windows) put it in the beginning of all UTF-8 files to indicate that they are encoded in UTF-8 even if they contain only ASCII characters (UTF-8 encoded message containing only ASCII characters is exactly the same as the ASCII encoded message). If you want to make sure the doc.kml file does not contain the extra character at the beginning of the file, you can save it using Latin-1 character set (but that will strip any extended characters that are not part of Latin-1 character set).

I have already implemented a fix for the KML parser in my own development version that avoids this problem, but I am not going to release a small bug fix only for fixing that parsing, as I am getting close to finishing the support for placemarks (aka waypoints, POIs, etc). But I will include the fix for this issue in the next released version.

Thanks for reporting this bug. I learned something new about UTF encoding and XML.

If you still have problems getting the maps to show up on your maps list, let me know and I will send you the full fixed kmz file. I am sending just the kml file to avoid sending the large kmz file to all the subscribers of this mailing list.

Marko Teittinen
doc_kml_fixed.zip

Gavin

unread,
Jan 6, 2012, 11:34:02 PM1/6/12
to Custom Maps users
Hi Marko,

Excellent - much appreciated! I look forward to the next Custom Maps
update now :)

Having a quick play, I still couldn't get the kmz file to play though
after replacing the doc.kml file with the one you provided. Maybe
Windows is intercepting the file somehow and re-adding the BOM char?!
I'm not opening the kml in anyway, only extracting it from your zip
and then replacing the original kmz doc.kml file with your own.

Though I would love to get a sneak preview of a working kmz file on
Custom Maps, no worries if you don't want to attach it to this mailing
list. Or if you want a much smaller example -
http://www.topomap.co.nz/kmz/AS21AS22_GeoTif_1-00.kmz - is only 456
KB. But seriously don't worry about it if it's taking you away from
being productive elsewhere!

Very much appreciated for all your time and effort!

Cheers,
Gavin
>  doc_kml_fixed.zip
> 3KViewDownload

piedelibero

unread,
Jan 14, 2012, 4:31:09 PM1/14/12
to Custom Maps users
Hi Marko,

Also I am experiencing a problem similar to the one reported by Gavin.
I have a collection of georeferenced maps in kmz format which I
generated with a software called Okmaps. This software is excellent
for georeferencing, and outputs kmz files which can (optionally) be
subdivided in tiles with dimensions that are optimized for Garmin
Custom Maps. I know for sure that the kmz's I generated work fine,
because if I open them in Google Earth they are visible and perfectly
georeferenced. I also transferred them to my Garmin gps, and they work
fine also on that device.

I have now copied a few of these kmz's in the Custom Maps folder that
your app created in my android phone (samsung galaxy s2). Problem is,
Custom Maps tells me the folder is empty. If I go in the folder using
the folder explorer, the files are there. But if I click on them and
tell android to open them with Custom Maps, again the app tells me
that the Custom Maps folder is empty.

I would really love to be able to replicate on my android phone
Garmin's custom maps function, and apparently your app is the only one
on the android market that is aiming to achieve this functionality.
I'm sure Custom Maps would work if I re-generated the maps from jpg's
using your app for the georeferencing (although I haven't tried this).
However, this would be a huge loss of time, considering that I already
have tons of kmz's that I painstakenly georeferenced during the course
of the last couple of years!

I hope that in one of the next releases you'll be able to make
externally generated kmz's visible in Custom Maps. If any additional
info on the problem I described above would be useful to you, just let
me know.

Thanks again for all your work on this app!

Pietro


them
>  doc_kml_fixed.zip
> 3KViewDownload

Marko Teittinen

unread,
Jan 14, 2012, 5:36:10 PM1/14/12
to custom-m...@googlegroups.com
Hi Pietro,

My best guess is that the software stores the map images inside a <Document> tag in the kml file (which is inside the kmz file). The 1.x versions of Custom Maps unfortunately do not support <Document> tag, but expects the images to be inside <Folder> tag. Version 2.0 which I am working on right now will find map images inside <Document> tags as well.

If you are technically oriented enough, you could try unpacking one of the kmz files using an unzip program, and replacing the <Document> and </Document> tags with <Folder> and </Folder> tags respectively, and Custom Maps 1.x might be able to see the maps in them.

I must warn you though that Custom Maps does not handle map image tile sets very gracefully. It will list each tile as a separate map in the map selection list, making it pretty painful to use such maps. You are better off not breaking the map images to smaller pieces, unless the image size exceeds the maximum map size Custom Maps can handle on your phone.

BTW, if you want me to take a look at one of the maps that doesn't show up and verify that 2.0 can read those files, please email an example file to me. I will test the file and see if the next version will be able to load it. And if only small changes are necessary to make it load, I will add the capability to 2.0.

Marko Teittinen
Reply all
Reply to author
Forward
0 new messages