Today we are having a look at some things you should know if you are a KML creator with the new browser based Google Earth in mind – with a focus on placemark popups. First, we must note that the new Google Earth is still very much a work in progress, especially with regards to KML support and we can expect major changes to the way it handles KML in the future.
The first thing to note is that the new Google Earth cannot access local files. This is a consequence of being browser based. Browser security does not allow web based applications direct access to files on your local computer. So, if you create a standard KML file which includes links to local images in popups or overlays and open it in the new Google Earth, you will not be able to see the images. If you save the file in the compressed KMZ format, then Google Earth puts the images in the file. That did work for image overlays but not placemark popups. We then tried uploading the KMZ file to Google Drive, as the new Google Earth has built in support for opening files from Google Drive. However, we found that trying to open KMZ files from Google Drive gives an error and only KML files could be opened that way.
Finally, we uploaded the image to GEB and linked it in the KML. When we did this, we found that the images did work correctly in placemarks and image overlays, but photo overlays appear to not be working at this time.
The next thing to note, is that when you place an image in a placemark popup, Google Earth does not know how large the image is until it is loaded. The consequence of this is that in Google Earth classic, the popup may be resized after the image loads. In the new Google Earth, this does not happen. If you close it and open it again, the image has been cached and it opens at the correct size:
Left: Opened for the first time. Right: Opened the second time.
The solution to this it to give the image an explicit size in your popup. An alternative would be to wrap your placemark content in a ‘div’ that has explicit style information.
Always include width and height for your images for better popups. This is true even for Google Earth classic.
Another option is to take advantage of the new popup options. We know of three new modes, ‘card’, ‘panel’ and ‘fullscreen’.
To use them, you have to edit the kml file and put one of these lines in the style information for a popup:
See an example of how it is done by inspecting the contents of this sample KML file
The ‘card’ mode does not seem to render HTML:
Also, when you click on it, it opens it full screen. We have not yet figured out how to specify the image. We believe it is intended only for Google’s use and links to Google Maps data via a custom tag:
The ‘panel’ mode opens in a side panel and we have seen GE Teach make great use of that mode. However, we found that using it on a plain placemark with a single image, it sometimes did not display the image.
The ‘fullscreen’ option displays the contents of the popup full screen and appears to work reasonably well with a simple image.