问题
I am creating KML files from an ArcMap layer that uses XSLT to generate an HTML popup with custom links to file folders. Some of these links have embedded spaces. When I try to open these links in Google Earth, it does nothing. I have tried encoding spaces as %20 and still GE will not open them. It opens links without spaces just fine.
Here is a link from my KML that works fine:
<a target="_blank" href="file:///C:/Land/ce">Central Wildlife District</a>
Here are a couple that don't:
<a target="_blank" href="file:///C:/Land/ce/Sites/AIKENS%20CR">AIKENS CR</a>
<a target="_blank" href="file:///C:/Land/ce/Sites/AIKENS CR">AIKENS CR</a>
I found a 6-year old problem report on Google Groups (https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/8PfajmyJbiY) that claimed this would be fixed soon. Is it really still a problem?
Has anyone managed to figure out a way to make links with spaces work in Google Earth KML?
回答1:
Whitespace and special characters in file names and folders have created problems in GE in the past:
- Bug #990: Balloon image viewer will not open when the image folder name includes a space
- Bug #1014: Embedded images in KMZ files don't display if the path to the KMZ contains spaces
- Bug #1126: GE6 can save but fails to load filenames with '#' in filename or path
Only real solution is to simply avoid such KML and either remove all whitespace from file names and paths or replace whitespace characters with _'s.
Of course with KML generated it's often a pain to manually do this but if you want the KML to view correctly on all platforms (Windows, Mac, Linux, Mobile, etc.) then you must eliminate any "special" characters in filenames and folders referenced by KML files included those inside KMZ files.
This is discussed in a related issue with whitespace in files within KMZ file.
来源:https://stackoverflow.com/questions/10903600/google-earth-will-not-open-links-in-kml-that-have-spaces