问题
I've saved kml and kmz files in a file cabinet in the old Google Sites. I copy the permalink to these files and paste it into the search box on Google Maps to overlay the placemarks.
I've saved a test kml file in a folder on the new Google Drive, but I can't figure out how to get a permalink that I can paste in Google Maps. I found this link https://webapps.stackexchange.com/questions/26371/how-do-i-share-a-permalink-from-google-drive and used it to create this permalink https://docs.google.com/file/d/0B9sBXp66G86xWmlRbkZiYlRNdmc/edit?usp=sharing but Google Maps does not recognize it as a valid kml file. Do I need to change the URL?
Thanks.
回答1:
- Set your root folder to share in the public. Right click on the folder > Share > Public on the web
- Upload .html file in the directory > Open it > Preview
- That's the url of your html, and you can find out the path to the kmz file that you want.
For example, here is my html file
https://googledrive.com/host/0B1YPetHU8aMQMmtrcFB4eTMzd1E/kml_overlay.html
My KMZ file url would be
https://googledrive.com/host/0B1YPetHU8aMQMmtrcFB4eTMzd1E/kmz/river.kmz
If you would like to see the list of files, access the root level.
回答2:
First check if is KML file valid for Google maps API (try it open e.g. at web version of google drive - if is valid web browser shows google map with kml layer).
Stored file address must have this form: https://docs.google.com/host............ (You can find the link at web version of google drive at file details/hosting) Link, that have form: https://drive.google.com/file...... will not work. (You can find the link at web version of google drive at file sharing
OR shortly sayed. Link must have file name at the end!!
- Working example can be downloeded from: developers.google.com/maps/documentation/javascript/examples/layer-kml
回答3:
If it is in kml format with specific name rename with a suitable name after downloading it to your pc/laptop which should not have special characters or spaces in it. For eg. if the name is ' walking 19 02 14.kml' then rename it as walking190214.kml. If it is kmz file (it is just like zip ) like 'walking 19 02 14.kmz' then first extract the 'doc.kml' file in it and rename the 'doc' with a name as described above. If you feel difficulty in extracting kmz file rename the kmz extension with zip extension ie abcd.kmz should be renamed as abcd.zip , then extract with winzip or winrar etc. Next upload the kml file to your 'Google sites / Google pages .Detailed steps are described in the following link
https://developers.google.com/kml/articles/pagesforkml
https://support.google.com/earth/answer/173934?hl=en
回答4:
Some of the functionality of Google Drive has changed recently with the new look Google Drive, so do this:
- Download the KML data file you want to visualise from Open Street Map or your local Ordnance Survey site.
- In a browser open “Google Drive” and click “New” (top left corner) Click on “More >” and then “Google Fusion Tables” (or click “connect more apps” if "Google Fusion Tables" is not already available.
- Import the downloaded KML file.
- If for some reason the map doesn't display ensure that the latitude/longitude columns were loaded correctly and if necessary tag them using the down arrow option in the header of the CSV table.
来源:https://stackoverflow.com/questions/15928455/linking-to-kml-kmz-files-on-google-drive