Link management in Google MyMaps and KML files

Google Earth link management

Google MyMaps is a very useful tool for people, who want to create their own map and base it on the Google Maps interface. Personally, I use it quite often, especially when planning some journey or placing some interesting objects across the World or some region. An important thing is to refer the stuff, prepared in our document to a particular location on the map and another way around. To link up some text or element in our document with the rough location on the map is not a difficult thing. On the contrary, making it in the reverse sequence can be sometimes quite tricky, especially when you don’t have basic software to help you with it. However, in this article, I am going to show you roughly how it works from both sides. Let’s go then!

  1. LINK THE TEXT OR OBJECT TO THE MAP

In most of the software used for writing, calculations, or drawing issues you have a hyperlink option. It obviously enables you to link up the text or particular object to the desired destination. In our case, this destination will be an interactive map created in Google MyMaps.
First of all, we should know what elements the Google MyMaps link includes. Basically, there are 2 link sections, which should draw our attention if we want to set our location properly (Pic. 1). There are:
– coordinates section,
– zoom factor.

Google MyMaps location and zoom link elements

Pic. 1 The most important elements of the Google MyMap link with respect to location hyperlink.

Apart from these, there are another 3, which we should know only out of interest for our purpose (Pic.2): user page, map mode (viewer or editor), and map ID.

Google MyMaps link elements

Pic. 2 Google MyMap link elements, where: 1 – user path, 2 – map mode, 3 – map ID, 4 – coordinates, 5 – zoom factor.

When you start to drag your map a bit, you will see that the link path with the coordinates section changes instantly. The coordinates value refers to the middle point of your map.
We can use this quite long URL to hyperlink some stuff in your document. For example in MS Excel (Pic. 3,4). We must choose the “Link” option and input our URL address. Don’t worry if it’s longer than an input frame. It will work.

Insert Google MyMap hyperlink to the MS Excel

Pic. 3 Insert our Google MyMap hyperlink to the MS Excel single cell.

MS Excel link to Google MyMap

Pic. 4 Our cell in MS Excel has been already linked with Google MyMap. When you click on it, the link redirects you to the particular location on the map.

Once you hyperlink your document to the particular location on your map, it will open in the default browser in the future (Pic.5).

Insert Google MyMaps hyperlink to MS Excel

Pic. 5 Insert our Google MyMap hyperlink to the MS Excel single cell.

Unfortunately, the link doesn’t switch you to the object directly, so you must click on the placemark located in the middle, however in my point of view is a minor thing.
Using hyperlinks from documents to Google MyMaps such as this is a very convenient way to pop out on the proper location. Furthermore, if your map is public, then everyone who is sharing your document can take a glimpse of the location, also in the mobile version. This is for sure the easiest and the quickest way to hyperlink your work to the map, wherever the hyperlink option is available (MS Office, GIS software, AutoCAD, etc.), also after saving the file in PDF version (Pic. 6).

MS Excel hyperlink to Google MyMap works in PDF version.

Pic. 6 An MS Excel hyperlink to the Google MyMap after saving the file in PDF format.

2. LINK THE TEXT OR OBJECT TO THE KML FILE

Unlike Google MyMaps, linking our work to a particular .kml file, a default format for Google Earth software can be a bit tricky task. Firstly, the difference lies in the file location. When linking to Google MyMaps you don’t need the tool to open it, except the internet browser, installed by default. The .kml file must have a Google Earth to be open. Otherwise, you won’t see the location, even when the hyperlink refers to some .kml file located on the server. However taking into account, that Google Earth is free software and widely common I can assume, that most people interested in GIS, geography, or tourism have this application on their computers.
Basically, the hyperlink from some document to the .kml file is straightforward, likewise a link to the map described above. Here we’ve got an option to hyperlink our .kml stuff offline, directly from our disk (Pic. 6).

Hyperlink from MS Excel to kml file

Pic. 6 Hyperlink from MS Excel to the .kml file located on your HDD directory.

The only gripe is, that usually, our .kml file includes more than one object (placemark) based in its directory. If you want to gain a rough location for your MS Excel cell or some object in your document (in my case it was one of the points of my honeymoon journey), then the easiest way will be an extraction of the object from the .kml file. You can do it on Google Earth. When loading your main .kml file you must open its content and find a specific placemark, which you need (Pic. 7).

Google Earth browsing the .kml file directory and searching for a specific placemark.

Pic. 7 Opening a .kml file in Google Earth and looking for a specific placemark, where: 1 – dark triangle “open” option for .kml file content; 2 – a search engine for a particular placemark and other .kml files located in the directory.

Once we find our placemark (Pic 8), we can download it to our private directory after right click and next hyperlink it to our document.

Google Earth saving our placemark as a separate object in Google Earth

Pic. 8 Saving the specific placemark from our .kml file as a separate .kml object (placemark).

Excel insert hyperlink to Google KML file

Pic. 9 Hyperlinking our newly saved .kml specific placemark in MS Excel cell.

Afterward, you will be redirected directly to the location on Google Earth (Pic. 10).

Clark International Airport (CRK) seen in Google Earth

Pic. 10 Redirect our MS Excel to the particular location in Google Earth – in this case, Clark International Airport (CRK).

The only demerit here is obviously the scale. Google Earth zoom after loading is set to a maximum value, which closes up our object as much as possible. This is nothing bad, although sometimes we would like to get around the area and make sure, that we are hyperlinked to the right place. Unfortunately, the .kml files are not equipped with a zoom factor at the XML code stage, and only what you can do here is zoom out via Google Earth. Alternatively, you can start to work with regions, where through the command you can the coordinate borders for your point as per below (Pic. 11, 12).

A placemark position in KML file, when open an XML code

KML file shown in XML language work with regions

Pic. 11,12 Elements consisting of your .kml file shown in XML language with sections to be modified in order to final object appearance in Google Earth software, where: red box – shows your placemark location; green box – shows your region placemark location (with similar coordinates), which must be added below.

After these small alterations to your .kml file, you can save it and open it in Google Earth again (Pic. 13).

.kml file shown as a region in Google Earth

Pic. 13 Your placemark is shown on Google Earth with an optimal enlargement.

So great! You have got your placemark with an optional enlargement, where you can instantly make sure, that the surrounding area is correct. However, there is still one issue, which can annoy a user a bit. This is obviously a thin gray rectangle, that frames our region selected previously in XML code. To get rid of it we can simply thick off this element in our .kml file directory at the sideline toolbar (Pic. 14).

KML placemark in Google Earth with optional zoom

Pic. 14 Our placemark with optional zoom and, most importantly, without framed region visible.

Remember, that this solution refers only to the situation when your file comes from the computer directory. I believe, that more often nowadays the .kml files are based on the web, i.e. in Google Spreadsheet. There you can also link your document to the specified placemark included as a whole .kml directory (Google Spreadsheet mapping), which was explained in detail here.
You can also set your zoom level only in the situation when your .kml file is based on the web. In this case, for example, the Google spreadsheet the process has been described in detail here. Another option is to set your own map based on Google Maps Javascript API, which is explained roughly here. Frankly speaking, the XML option is an alternative for someone, who is not clued up enough with programming skills. Truth be told more stuff and advice is available for the Google Maps JavaScript API, which I explain in the future.

3. LINK THE GOOGLE MY MAPS OBJECT TO THE DOCUMENT

Link some object (placemark) created in GoogleMyMaps is, unfortunately, a tricky issue. First of all, GoogleMyMaps doesn’t support a hyperlink directly from the interface neither for point nor for linear objects (Pic. 15). Using at least a different interactive map builder will be beneficial if you don’t want to fight with XML code.

Google MyMaps linear object Anda Bohol

Pic. 15 A linear object example in Google MyMaps

The best for this purpose I believe is the Scribble Maps interactive map builder, which is widely common among another dozen or so similar platforms. If you wish to have all placemarks linked, then you must generate the .kml file from your Google MyMap (or some single layer, when applicable)(Pic. 16, 17) and save it somewhere in your directory (Pic. 18).

Google MyMaps selecting layer to download as a .kml file

Google MyMaps layr download

Pic. 16, 17 Selecting a single layer from Google MyMaps to download as a .kml file.

Saving .kml file from Google MyMaps

Pic. 18 Saving your .kml file, created in Google MyMaps.

After this, you should import your file into a new Scribble Map, which will open automatically after loading (remember to drag to your placemark locations!). At first glance, your placemark group won’t look fine. This is because Scribble Maps doesn’t support icons from Google MyMaps (Pic. 19), although don’t worry about it, because when you do the saving and uploading in reverse sequence, then you retrieve all icons in Google MyMaps again.

Manila journey imported as an .kml file to ScribbleMaps

Pic. 19 Imported .kml file into ScribbleMaps interactive map builder won’t look good due to lack of icon support.

Having your .kml embedded in the Scribble Map interactive builder you can start to edit every single placemark, adding a link to the description.
In the new, single example I will show you how to do it effectively.

Well, I have created a single placemark, which is called a Lacher See (a volcanic lake in West Germany). Now, after opening its editor I have a few options to input a link i.e. pictures, Youtube, etc. For us, the most important is an anchor-looking signature (Pic. 20) called “Add link”.

Link in Scribble Maps interactive map builder

Pic. 20 An “Add link” option in the Scribble Maps platform.

Let’s input some random URL path, let that be some informative website about this place, which for instance Wikipedia. Obviously, don’t forget to set an “Open in new window” option (Pic. 21).

URL link in Scribble Maps placemark

Pic. 21 Input a URL link in the Scribble Maps placemark.

We can add up more, than 1 link to a specified website, attaching, for example, a restaurant and hotel nearby (Pic. 22).

Input a multiple links in Scribble Maps placemark

Pic. 22 Input multiple links in Scribble Maps placemark.

Apart from a link only, you can embed both a YouTube movie or picture (Pic. 23). Think about adding a picture as a link through the Scribble Map, because this builder requires the URL to the picture (Pic. 25), which not always work (Pic. 26). It will be better to fill up in Google MyMaps later (Pic. 27), alternatively, your picture has been already attached before you made a .kml file.

Scribble Maps link from Youtube

Pic. 23 Adding a Youtube stuff to your placemark in Scribble Maps.

Both your YouTube and image files either in Google MyMaps or Scribble Maps should be loaded automatically, showing you a graph miniature inside the placemark description (Pic. 24). Then you can be sure, that everything is fine with your link.

Youtube miniature inside placemark in Scribble Maps

Pic.24 A YouTube miniature shown in your placemark description in Scribble Maps.

Adding picture in Scribble Maps

Pic. 25 Adding a picture to the placemark in Scribble Maps.

Scribble Maps image issue in Google Earth.

Pic. 26 An error with an image that occurs sometimes in Scribble Maps will result in a question mark in your placemark description in Google Earth.

Returning to the image issue and their disappearance in Google Earth, we can use Google MyMaps to check if our link is supported by GoogleUserContent at all. If so, you should have a graph loaded, if not, then you receive info like this (Pic. 27).

URL image error Google MyMaps

Pic. 27 An image URL error, can occur when inputting an image from the Web to GoogleMyMaps.

In general, links like Flickr or Wikimedia are not supported. In this case, it better is to download your picture first to the computer and then upload it to Google MyMaps from your drive.

When you add up everything, then you can generate a .kml file in Scribble Maps, download it, and upload it to Google MyMaps. A basic demerit is, that every single .kml file in Google MyMaps is treated as a separate layer, which really restricts our work there because Google MyMaps provides 8 layers only. At the outcome, you are able to import 8 single .kml files only. Much better is, when your .kml file includes all placemarks, that you need, unlike my example provided.
Anyway, the link should be clearly visible in your Google MyMap now (Pic. 28-30).

Linked placemark in Google MyMaps

Linked placemark in Google MyMaps with picture attached

Pic. 28 – 30 Linked placemark in Google MyMaps with; 28 – Youtube movie attached; 29 – Youtube movie + image attached; 30 – all links created in Scribble Maps.

As you may have noticed, the hyperlinks are available, however, did we really want them in a form such as that? We would rather have the main text hyperlinked instead of having these long hypertexts underneath.
So we can somewhat do this in Scribble Maps. However, we cannot write the text outside our link, because it won’t work. We cannot also select our text and mar as a hyperlink. One thing, that we can do is start writing our text inside the existing hyperlink (Pic. 31) and remove not needed pieces as shown below.

Manual link edition for placemark in Scribble Maps

Pic. 31 A placemark manual link edition in Scribble Maps.

Ok, when you prepare your hyperlinked text, then save your placemark, create the .kml file, and import it to Google MyMaps. Unfortunately, Google MyMaps doesn’t support solutions like this, although your information will still look better, than previously (Pic. 32).

Google MyMaps hyperlink after edition in Scribble Maps.

Pic. 32 Hyperlink in Google MyMaps after manual edition in Scribble Maps.

As a result of the manual hyperlink edition in Scribble Maps, you should get a solution in Google MyMaps as above. Your text won’t be linked, as you would like, although the form with a bracketed link path can be accepted in general.

At the finish of the link issues in Google MyMaps, I would like to show link options supported by this platform (Pic. 33).

Google MyMaps links

Pic. 33 Link options supported by the Google MyMaps platform.

Fortunately, Google Earth reads our hyperlink properly (Pic. 34).

linked text in .kml file in Google Earth

Pic. 34 Linked text in .kml file shown in Google Earth.

4. LINK THE .KML FILE TO THE DOCUMENT

Another important element is a link to the .kml file, placed in Google Earth to the document. A basic placemark with one or more hyperlinks looks as per in the picture above (Pic. 34), where you can see linked information inside the description. These links can redirect both to URLs and to some particular documents, placed on your hard drive.
If we would consider taking a look at our link structure in XML code, then it could look like this (Pic. 35).

KML file hyperlink in XML language

Pic. 35 A hyperlink for .kml file as shown in XML language, where: 1 – ![CDATA[…]] – the most important element, enabling you to input some HTML/CSS stuff inside the brackets; 2 – The HTML code with the link, open way, and short description. Click to enlarge.

The most important is ![CDATA[…]] command, which enables us to input an HTML or CSS code inside. Then we can both create a link to some document or URL, directly from the .kml file, or style the .kml description, which will be discussed in the future.

ML file with links to Youtube, text and image

Pic. 36 All links (Youtube, text, and image) are included in our placemark as shown in the XML code.

The picture above shows us all the links used by myself for the purpose of this article (red frame). This is a simple HTML code with content and tags, dividing our description correctly. As you can see, you have another placemark included in your .kml file with a similar ([CDATA![…]]) description, as shown underneath (yellow frame). In Google Earth, our file will look as per in the picture below (Pic. 37).

Placemark with all links shown in Google Earth.

Pic. 37 Our .kml file with all links is shown on Google Earth.

Now we have got everything, that we need: a Youtube link, text link, and image link. Remember, that there are some troubleshoots with image links in Scribble Maps, which has been mentioned earlier. Frankly speaking, some image URL links are not supported in that interactive image builder and it better is to input them manually in the XML code, as above (Pic. 36, 37).

Our .kml file may include also linear objects along with placemarks. However, in this case, we cannot rely on Scribble Maps at all, because this interactive platform features the text and link editor for point objects only. As far as we know, the description of the linear object is also possible, at least in the Google MyMaps platform (Pic, 15), which unfortunately doesn’t support a text link editor.
In this case, we must resort to the XML code again and implement the object features manually (Pic. 38).

Placemark XML code with hyperlink

Pic. 38 The XML code of linear placemark with a relevant description with hyperlink. Click to enlarge.

Afterward, we can see a nice effect in Google Earth (Pic. 38).

Linked linear object show in Google Earth, Youtube and image

Pic. 39 A linked linear .kml object is shown in Google Earth. Here are 3 kinds of links: text, image, and YouTube.

Probably spotted, that I input something special into this code. I decided to spice it up a bit and bring some CSS style codes inside in order to change the hyperlink text from a thin blue to a strong red. This stuff will be better explained in a separate article in the future.

An analogous work should be done for some path or trail, which is also a linear object (Pic. 40, 41).

KML linear object with description

Pic. 40 An XML code for the linear object in a .kml file with a relevant description including some external links. Click to enlarge.

KML file example path in Google Earth

Pic. 41 An example path with links and descriptions is shown on Google Earth.

I hope, that all this information will be helpful to you. As you have seen, the link management in .kml files can work in two different ways. One of them is interactive map builders, which are the easiest and quickest way to manipulate. However in some cases, using the XML code in external software, like Notepad++ can be also required. It obviously doesn’t change the fact, that the link management in all .kml files is a relatively simple issue.
Another kind of link, which can be used in .kml files is network links. Network links play an important role when you would like to make your placemark more dynamic. It means, that you can input links straight to another .kml file, placed somewhere in the server i.e. Dropbox, and keep your placemark content most up-to-date. Moreover, by network links, you can include large datasets into your .kml file More about the effective use of network links you can read this documentation or watch the video below.

Mariusz Krukar

 

References:

1. Gibson R., Erle S., 2006, Google Maps Hacks, O’Reilly Media Inc, North Sebastopol, CA

Links:

  1. Google Earth outreach: Mapping from a Google spreadsheet
  2. https://gokml.net/
  3. Keyhole Markup Language standard
  4. KML 2.1 tutorial
  5. KML reference
  6. XML managing data exchange – Google Earth
  7. Customize maps with JavaScript API
  8. Using Google Sites to host your KML
  9. Adding images to a Google Earth placemark
  10. Using .kml network links effectively

Forums:

  1. Hyperlinking placemarks within a KML file
  2. Opening a kml file with Google Earth at a specific placemark
  3. Network Linked KML to a Folder of KMLs
  4. How do I link to internal files in a KMZ file?
  5. Creating Links to PDF’s of boring logs in Google Earth
  6. Set zoom after loading KML layer
  7. Setting zoom level in KML/KMZ file?
  8. Working HREF inks in KML files stop working when zipped into a KMZ files
  9. Google Maps zoom gets overridden when using a KML file

 

Youtube:

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *