How can I get a KML/KMZ file to display on Google Maps without a public facing web server?
-
The ironic thing about your question is that you are connected to the Internet. How do you get Google Maps?– CrazyEnigmaCommented Jul 24, 2010 at 2:31
-
by "without a public facing server" do you mean the kml has to be on the local machine, or that you don't want to have to bother with installing/configuring/buying a public website? And, does the custom map you want to make need to be seen by others or just you?– matt wilkieCommented Jul 24, 2010 at 6:46
-
THe situation is "I can get to the internet, but the internet can't get to me." In that case, you can't use the KML-file support in the Google Maps API.– Christopher SchmidtCommented Jul 24, 2010 at 20:22
-
display-kml.appspot.com is another option I suppose .– Karl HenselinCommented Sep 29, 2013 at 21:58
-
You can download KML / KMZ to Google Drive, it natively supports visualization docs.google.com/file/d/0B9sBXp66G86xWmlRbkZiYlRNdmc/edit– KindDragonCommented Mar 21, 2018 at 19:45
6 Answers
To open a KML or KMZ file in Google Maps, I append the following prefix to an online link of the KML file:
http://maps.google.com/maps?q=
Typically, I put the KML or KMZ in my dropbox, and then copy/paste the public link to the end of the above snippet. Then I can email that link to whom ever wants it, or I post it online somewhere. I've also used Google Docs to store the KML's, and a Links page on my website to distribute the links.
Example:
Harvey Mountain Hike:
http://maps.google.com/maps?q=http://dl.dropbox.com/u/359140/KML/HarveyMountainHike.kmz
-
17This approach doesn't appear to work any more. Upon clicking the above link, I just get google maps with your dropbox link in the search box. Commented Sep 30, 2014 at 14:51
-
7Working with KML on maps.google.com will soon be deprecated though: support.google.com/maps/answer/41136?hl=en– Koen.Commented Feb 4, 2015 at 12:55
-
2I have found that you can simply click on the share link from Google Drive and the KMZ will automatically load in Google Maps without any other need for extension. Tested in Chrome and Explorer. Commented Mar 23, 2015 at 17:27
-
10
-
5April 2017 UPDATE: you can directly import a KML file into Google Maps' "My Maps" feature, and it will display all of your KML data in a Google Maps format.– BaodadCommented Apr 19, 2017 at 21:14
Is this for something that you want to have permanently available to others, or just for temporary viewing?
One of the tricks that I use quite often is to place the KML file in my public DropBox folder (find someone with an account to refer you; it will get both you and them an extra 250Mb) and then paste that url into Google Maps to visualize and share with others short-term.
In the longer term, you do have the option of creating a new Google "My Maps" map, and importing KML, KMZ or GeoRSS into that. Once done, you can share the resultant map using the standard My Maps tools.
You can also use Google Docs to store and share KML files with others. My recommended technique is to:
- Create a folder and mark it for public access.
- Use the Upload link to upload your KML files into this folder without conversion and shared with the world
- Go to the Download link, copy it, and paste it into the Google Maps search box
I wonder how long before Google allows interactive collaborative editing of KML documents via Google Docs? Now that would be cool...
-
One thing to take care about: if you change the file (and this may include "save as" with the same filename), Dropbox will change the file ID (the hash part) in the link. Regular opening and saving (in a text editor, for example) doesn't appear to pose problems. Commented Jan 26, 2015 at 19:09
You can upload a KML file to Google Maps:
- Log in to your Google Account, and go to http://maps.google.com
- Click on
My Maps
- Click
Create a new map
- Add a title and description
- Click
Import
- Click
Choose file
, select the KML to upload, and then clickUpload from file
(source: askdavetaylor.com)
(source: askdavetaylor.com)
(source: askdavetaylor.com)
Now you're done :)
-
Interesting, this is the answer that most directly addresses the question. Commented Aug 5, 2014 at 16:11
-
Does not work for KMZ containing a KML file which exceeds 5 MiB.– SusschCommented Jan 2, 2019 at 12:20
You can't
Google:
From February 2015, maps created in the classic Google Maps — https://maps.google.com/ — will no longer load KML/KMZ files from external websites. However, we know that KML files are a really useful way to work with geographic data, so we’ve added KML to Google My Maps, and continue to support this format with other Google Maps APIs. We hope that one of these options will meet your needs.
https://developers.google.com/maps/support/kmlmaps
I used to display local .kml and .kmz files in google maps, but now i can't :(
-
1
-
KML files may not import all their data, including: Info balloons with HTML or JavaScript, KML tours, Time-based elements, Image and screen overlays, MultiGeometries, 3D models, Folders developers.google.com/maps/support/kmlmaps– DaleCommented Mar 29, 2017 at 13:33
The short answer is: you can't. Using a local file with the plain old Google Maps web application would violate the browser's sandboxing and same origin policy.
One option, however costly, is that you may be able to use Google Maps Premier to host the maps-x.js on your local filesystem along with the associated KML.
Another option is to use an existing public facing web server, like Google Sites.
Also, keep in mind that you may be able to use OpenLayers as an alternative to Google Maps Premier.
-
2OpenLayers will be limited (in modern browsers) to non-file URLs, at least in Firefox, but you can set up a local/non-public webserver and use that. Note that the "Sandboxing" isn't really the reason that you can't do what you want with Google: If an HTML page is hosted on your local server, the JS should be able to read a file from the local server. You only can't because Google parses all files on the server side -- so their server needs to talk to your server, which it can't. Commented Jul 23, 2010 at 17:15
-
Ah, good point. I was thinking along the lines of a file on the local filesystem rather than a local httpd. Commented Jul 23, 2010 at 17:19
https://support.google.com/mapsengine/answer/3024836
Click Import. You can import CSV, TSV, or XLSX files, My Maps, or spreadsheets from Google Drive. KML import is not currently supported.