GPSFileDepot.com
 

News:

Welcome to GPSFileDepot!

Main Menu

Google Maps used to support KMZ files...

Started by dbperry, December 13, 2012, 07:38:06 PM

Previous topic - Next topic

dbperry

Google Maps supports KMZ files... but not perfectly. I did a quick search on these forums and haven't seen it mentioned, so I figured I would share what I learned.

I was actually introduced to this idea from a steward of one of the properties that I had created a KMZ for. He led me to upload the KMZ to my website to see how it would work in Google Maps. I can get this particular KMZ to display in Google Maps, but not properly. For some reason, Google Maps doesn't support the rotation. So the map is centered on the correct spot, but without the necessary rotation:
http://maps.google.com/maps?f=q&hl=en&q=http://www.dbperry.net/KMZ/Hemlock_Gorge_Ver_1.00.kmz

A little google searching reveals the problem:
https://developers.google.com/kml/documentation/kmlelementsinmaps
(note that KML element <rotation> is not supported)

and a potential solution:
https://groups.google.com/forum/?fromgroups=#!topic/kml-support-getting-started/nIC5DQr-Q4g

I understand Nymor's fix and I understand how I could do it. But I'm not going to bother...too much work for not much benefit, especially considering the incredible complexity of the massive Hemlock Gorge reservation... ;)

I uploaded my KMZ of Notchview, which doesn't need rotation, and that turns out pretty cool:
https://maps.google.com/maps?f=q&hl=en&q=http://www.dbperry.net/KMZ/Notchview_ver_1.00.kmz

I tried my Blue Hills KMZ, but it is too big. File size limitation is 3MB:
https://developers.google.com/kml/documentation/mapsSupport

The downside to this feature is that you need a website / server to host the raw KMZ file - obviously Google Maps can't support the zipped KMZ files that are hosted here.

But a pretty neat feature that I didn't know about before today!

Dave
My custom KMZ map collection:
http://www.gpsfiledepot.com/maps/byuser/13384/

Boyd

Pretty cool. I didn't know that was possible.  8)

-Oz-

The non-rotated one looks pretty awesome.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

dbperry

I continue my quest to become an expert KMZ file maker...but with all the IMG map creation expertise around here, I feel like becoming an expert at KMZ files is kind of like hanging out at a party of math PhD's and saying "yeah, but I'm REALLY GOOD at addition!"

Anyway....

1) workaround for Google Maps limitation on 3 Mb KMZ files: Since we (those of us creating KMZ files for Garmin GPSr) already have to use some kind of tool (I use MAPC2MAPC) to accommodate the Garmin limit of 1 Mb, we are halfway to the solution:
a) after creating the multiple tile KMZ file for the Garmin KMZ, create multiple smaller KMZ files with the right number of tiles to keep each KMZ file less than 3 Mb. (I have found that the best performance is actually with KMZ files less than 1.5 Mb). This is really easy to do if you have one KML file (from within your 'master' KMZ) that references all the tiles. You just use that KML as the basis for all of the KML files in the smaller KMZ files - just delete the references to the tiles not being used in each KML file associated with the multiple smaller KMZ files. Essentially you're building the multiple smaller KMZ files with a text editor to manually edit the KML files, and manually compiling the smaller KMZ files with a ZIP file editor.
b) Create a KML file with "network link" attributes that can be read by Google Maps.

This is all easier to understand with an example. See my "Middlesex Fells" KMZ here:
http://www.gpsfiledepot.com/maps/view/579/

The KML that is used to generate the Google Maps 'preview' is here:
http://www.dbperry.net/maps/fells.kml
You can download it and open it up in a text editor to inspect the syntax. Basically it is calling 10 separate KMZ files which 'tile' together to create the full map.
Unfortunately, the Google server 'reading' / 'loading' of KMZ files seems slightly unstable - sometimes you have to 'refresh' your browser a few times before all the tiles will load in.

2) The same "network link" attribute in a KML file can be used to display overlapping KMZ files. See this example:
https://maps.google.com/maps?f=q&hl=en&q=http://www.dbperry.net/maps/nw_fram.kml
(which are the maps in my Northwest Framingham "Bay Circuit "E to K" KMZ Series:"
http://www.gpsfiledepot.com/maps/view/607/

It even uses the draw priority of each KMZ to display the KMZ files in the correct / intended overlap!

3) There is a workaround to simulate transparency for KMZ maps in Google Maps. KMZ files support the GIF file format, and the GIF file format supports transparency. So you can:
a) convert your JPEG map to a GIF
b) replace the 'background' color of the GIF with 'transparent' pixels. Photoshop Elements or Photoshop can do this.
c) Create a KMZ file with the GIF file as the image.
d) When you load that KMZ file into Google Maps, it is "semi-transparent"

I tried this and it is pretty cool, but I didn't save my example, because...

I have abandoned this approach because Garmin does NOT support KMZ files made with GIF files. Garmin only supports JPEG. So I am going to focus my efforts on KMZ files that are compatible with the Garmin GPSr, which is my real reason for creating KMZ files. Too much extra work just to get transparency in Google Maps (although it does make the Google Maps KMZ implementation much more usable).

4) Finally, last, but certainly not least, I found the Gmap4 website, which (among other things) uses the Google Maps API to display KMZ files on all kinds of maps. For example:
http://www.mappingsupport.com/p/gmap4.php?q=http://www.dbperry.net/maps/nw_fram.kml

Notice the menu in the upper right corner - you can choose 13 different 'foundation' maps as the background!

Lots of neat features on the Gmap4 website: http://www.mappingsupport.com/p/gmap4.html

My next project will be to create an interactive, hot-linkable Gmap4 map with all of my KMZ maps. In other words, a big (small scale) view of New England with all of my KMZ maps displayed. Clicking on each KMZ map will bring you to the correct GPSFileDepot page where you will be able to download the Garmin compatible KMZ.

Fun stuff!
My custom KMZ map collection:
http://www.gpsfiledepot.com/maps/byuser/13384/

Boyd

#4
Cool stuff again!  8)

Quote from: dbperry on June 21, 2013, 10:18:41 AM
I continue my quest to become an expert KMZ file maker...but with all the IMG map creation expertise around here, I feel like becoming an expert at KMZ files is kind of like hanging out at a party of math PhD's and saying "yeah, but I'm REALLY GOOD at addition!"
Well you do have a little company here.... My New Year's project was learning the basics of javascript and the Google API. I built this site in about a week using USGS NED 1/9 arc second data rendered in Globalmapper and combined with the road, hydro and POI data as used in my vector based maps.  :)

http://boydsmaps.com

Have been meaning to get back to this but am too easily distracted by other things. But I like the idea of using the web for maps because they are easily accessible to everyone with a couple mouse-clicks and don't require downloading or a gps device. However the next step with this site will be to add a custom maps download capability. Should be very straightforward, I will just break it into USGS quads. At full resolution (about 10 ft per pixel) a 24k quad will require 16 1024x1024 tiles (4x4), so you could load 6 quads on the older devices or 31 on the Montana or Oregon 6x0.

Actually I would like to investigate other mapping API's, preferably open source. For what I'm doing, I don't need any of the google features like geocoding or basemaps. I just need a straightforward way of putting a map in a browser window.

BobT

I've only got one thing to say.  2 + 2 = 4.  That's my contribution to this intriguing thread.

CliftonLindsey

Quote from: dbperry on December 13, 2012, 07:38:06 PM
Google Maps supports KMZ files... but not perfectly. I did a quick search on these forums and haven't seen it mentioned, so I figured I would share what I learned.

I was actually introduced to this idea from a steward of one of the properties that I had created a KMZ for. He led me to upload the KMZ to my website to see how it would work in Google Maps. I can get this particular KMZ to display in Google Maps, but not properly. For some reason, Google Maps doesn't support the rotation. So the map is centered on the correct spot, but without the necessary rotation:


A little google searching reveals the problem:

(note that KML element <rotation> is not supported)

and a potential solution:
started/nIC5DQr-Q4g

I understand Nymor's fix and I understand how I could do it. But I'm not going to bother...too much work for not much benefit, especially considering the incredible complexity of the massive Hemlock Gorge reservation... ;)

I uploaded my KMZ of Notchview, which doesn't need rotation, and that turns out pretty

I tried my Blue Hills KMZ, but it is too big. File size limitation is 3MB:


The downside to this feature is that you need a website / server to host the raw KMZ file - obviously Google Maps can't support the zipped KMZ files that are hosted here.

But a pretty neat feature that I didn't know about before today!

Dave
yes it supports KMZ files and it perfectly runs on my iPhone.. Very useful indeed

dbperry

So Google Maps DOESN'T directly support KMZ files as they had in the past. That functionality was removed earlier this year.

But I've discovered a number of solutions:

1) As mentioned above, the Gmap4 website is fantastic. Very powerful map engine. And it still supports KMZ files / overlay maps.

2) I ran into some problems that appear to be related to the speed at which the JPEG images would be read out of the KMZ files. Found a great workaround:
Within a KML file, instead of referring to embedded JPEG files within a KMZ file, simply post the JPEG images on a server and use an absolute reference to the JPEG files in the KML file. In essence, you build a KMZ file to get the proper KML language and lat-long bounds of the overlay, then you deconstruct the KMZ file and use the resulting KML file and images that were in the KMZ file.

A picture is worth a thousand words:
http://www.mappingsupport.com/p/gmap4.php?q=https://dl.dropboxusercontent.com/u/78581604/maps/blue_hills.kml

That KML file is hosted in the public section of my Dropbox. If you open / edit that KML file, you see that it refers to 24 JPEG images hosted in the Dropbox folder - not in a KMZ file.

So you get the benefits of a KMZ overlay map, with all the great features of the Gmap4 map engine, plus it renders much faster than opening a KMZ file.

The link above works great on an iPhone - and by turning "location on" in the MENU of the Gmap4 webpage, your location is displayed in real time....kind of like a GPSr....uh oh...did the Gmap4 website just put another nail in the handheld device coffin?
My custom KMZ map collection:
http://www.gpsfiledepot.com/maps/byuser/13384/