Google Earth will not open links in KML that have spaces - kml

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?

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.

Related

<a href> will not open links when the path has spaces. (kml)

I am using google earth to map placemarkers that each display their attributes. Some of the attributes are hyperlinks that open up a file or folder. When I use a-href to link a folder path that includes spaces, the link will not work in Google Earth. Is there a way to make the link work without changing the folder name?
While printing href attribute, you have to escape it for html special characters. So your spaces will be %20.

I need to find a string within the website files. Specifically looking for the footer HTML files

I've been asked to change part of my client's website which has their social media icons in their footer. They're using WordPress, and while I'm very familiar with editing footer.php or the footer widgets, the HTML in this footer file is in neither one of them. I can't find it in any other files I've looked in, and none of the plugins have any of that functionality.
I figure if I can search all of the website files for the HTML code that's in the footer, I'll find the code and be able to update it. I checked with FileZilla, but it looks like I can only search by file title with that.
Any ideas? I heard that searching by grep is a possibility, but do people still do that?? And I've never done it. Here is a link I saw it in: Grep to find a file that contains a string in a directory
Thank you ahead of time!!!!

Inkscape doesn't allow to edit svg text lines once it has been saved as plain svg or treated with scour

I was for several days trying to find a solution to the following problem :
Create a svg with text (simply click with the text tool to add text, do not drag to open a frame)
Type enter to create a multiline text, add several lines of text
Save as plain svg or optimized svg
Or treat with scour in command-line
Reopen with Inkscape : you cannot edit the text, it shows it properly but when you go to the next line (with the mouse or keyboard arrow down) the cursor stays on the first line.
This is an annoying bug running for some time in Inkscape and doesn't help with web edition.
But there are solutions... See the following thread to manually (in vim) replace all tspans :
Vim search replace regex + incremental function
And see my answer below to correct the svg code in order to get your Inkscape files back in working order !!!
SVG files do not currently support multi-line text. Inkscape uses custom XML attributes to keep track of which spans of text are part of that block of text.
When you save as Optimized SVG, Inkscape strips out all its custom XML attributes and writes a vanilla SVG file. So the sense of what is a block of text is gone.
Sed is very useful in order to correct your files in a batch:
cd /home/user/my/svg/files
sed -i.bak 's|<svg|<svg\nxmlns:xlink="http://www.w3.org/1999/xlink"\nxmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"|g' *.svg
This runs on all svg files in the current folder and :
Creates a .bak file which you can rename to svg in order to get your original files (but I nevertheless strongly advocate to duplicate your working folder in order to avoid terrible mistakes when fiddling with sed)
Adds the correct namespaces with newlines (\n)
Then:
sed -i.2.bak 's|<tspan|<tspan sodipodi:role="line" |g' *.svg
This appends sodipodi:role="line" to all tspan tags in the current folder and creates file.2.bak backups.

This SVG is invalid. Validate it before opening

I just modified a svg file that came with my Wordpress Template but i come up to this: Error Line 787, Column 77: there is no attribute "sketch:type"
<g id="city-copy" transform="translate(1305.000000, 47.000000)" sketch:type="MSShapeGroup">
Open the svg in a text editor and remove the sketch:type="MSShapeGroup" attribute from the <g> element. An even better maneuver would be to optimize your svg with a tool like svgo.
Check the encoding value.
I changed the encoding="windows-1252" to encoding="utf-8" and worked for me.
This can be caused by a variety of things but I've been able to solve this by:
open the SVG in Inkscape
Go To File > Clean Up Document
Save the SVG (choose a unique file name so you do not lose your previous work).
guys! I saw this tip on another forum, and it worked. I managed to fix the corrupted file. What you have to do is:
Open the file in a text-editor (I used Dreawweaver)
Check the first line for entries like: xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;", and delete the '&' characters so it reads: xmlns:x="ns_extend;" xmlns:i="ns_ai;" xmlns:graph="ns_graphs;"
Save the file, and Illustrator will open it.
Good luck!
Thanks much for the how-to principle. In my situation, using that idea (of opening the corrupted SVG file with a text editor since Adobe Illustrator wouldn't open the file), I used a text editor (Smultron) to open both the corrupted SVG file and an openable SVG file. I compared the upper area of both files; saw that certain lines of code were missing from the corrupted SVG file; copied those few extra lines of code from the openable (working) SVG; and saved. AI could then open the formerly corrupted SVG file. I copied the layers I needed into a new AI file and abandoned the formerly corrupted SVG.
AI version CS7 is saving invalid SVG and SVGZ files. In my case, two namespaces were missing from the SVG file.
Use the Export to SVG instead. It save the SVG without the need for namespaces.
I had similar problems with svg files that I had saved in Adobe Illustrator. The easy fix for me was to open the files in Inkscape and save a copy, and these files are fine.
The original error message said "The SVG file is invalid. Validate it before opening." The ironic thing is that after saving a copy with a new name, the original files will now open inĀ  Illustrator.
As a complete non-techy, I followed the advice above and opened my SVG in text editor. None of the problems above were in my file so I compared the file to a working SVG file, trialed a few things and discovered that
" 0 0 no-repeat
at the very end of the code outside of the tag was the culprit! Deleted this and voila! :-)
Wow, so many different answers! Might as well add my own... This is handled the error in Adobe Illustrator when opening a file downloaded from the internet, might work in other scenarios as well.
I opened the svg in a text editor and noticed that the XML prolog at the beginning did not match a different, working, file. Specifically the non-working one was version 1.1 and did not include the standalone="no" attribute. So the fixed prolog now reads:
<?xml version="1.0" encoding="UTF-8" standalone="no">
Worked for me!
After opening my svg in a code/text editor, in my case Visual Studio Code I noticed that mine had <DIV id="container"> and </DIV> surrounding the <svg..... > data.
Removing this div tag solved my issue.
I stumbled on another easy fix by luck: I was about to open an SVG in a text editor, when I noticed that OSX was defaulting SVGs to ImageOptim, an app I use for stripping metadata, etc. So I let that have the file, and a moment later I had a valid SVG file that took up 68% less space on disk.
I had a similar problem, which was not solved by any of the above mentioned solutions. In the end I solved it by unchecking the box 'Export RDF metadata' when creating the SVG file (in QGIS in this case).
Most likely something in the RDF metadata must have been unreadable for Illustrator, but I didn't manage to figure out what part exactly.

KMZ displayed incorrectly after Save to My Places and restarting Google Earth

I have several KMZ files (for example see https://www.dropbox.com/s/60pk3xx82ydwwml/RiveraAndresRecent_glacier_variations_S0895981113000382_2.kmz). When I open one of these KMZ files in Google Earth everything looks fine. However when I select "Save to My Places" by right clicking the file in the Temporary Places panel and restart Google Earth, the KMZ file is displayed incorrectly. I see several red crosses instead of the image. I suppose the networklinks in my KML file are somehow incorrect - the related image files cannot be located anymore by the KML. Is there a way to solve this, so that I can save my KMZ-files correctly to My Places?
There is a bug in Google Earth with respect to having a KMZ with NetworkLinks whose target has referenced files being saved in the saved places file. When saved the base file path in your KMZ file is changed from the KMZ location to the location of the saved places file and the nested KML files and icons/images no longer refer to a valid file path.
A workaround is to save the KMZ in a non-temporary folder (e.g. My Documents, etc.) and create a Network Link in Google Earth to that file. From Google Earth menu, click Add/Network Link then browse to the KMZ file and click "OK". Then save to 'My Places'.
There are a some validation errors in the KML, but those errors are not contributing to the bug you're now seeing. You can get a list of the errors using KML Validator. Note the KMZ itself is too large but you can upload and just validate the doc.kml first.

Resources