Google has now stopped its Earth API and Maps API is a paid for API nowadays. Some capabilities have also been either removed or changed. Therefore, I had to remove all examples of VizMap applications I had created. I didn’t remove the entire topic as I thought some of the code may still be useful with some modifications. 

javaScript: Click events in Google Earth

This relates to Data Driven Mapping applications and the Javascript HowTo section

Events in Google Earth

I deal with event handling in Google earth in Using Google Earth but dealing with click and double click events is especially tricky, made even more so by cross browser issues.
[su_space rsize=”10″]

Knowing the difference between click and double click

If you try to handle the double click, firstly you lose the useful double click behavior native to Earth, but also the first click of a double click fires off a single click. In the case oft his application, single click means bring up an info Balloon, and double click is to mean go to the next spot, so I had to find a way of handling double click.

Here’s the code below


The trick here is to only handle single clicks, but if a single click happens within a short time (in this case var doubleClickTimeout = 300;) then process as a double click.

This is achieved by setting a timeout that calls a function spot.createInfoWindow to deal with a single click if a second single click didn’t happen within the timeout period. If it did happen, then it’s a double click.

Dealing with multiple browsers

As usual questions, feedback and comments are welcome at our forum. Now lets take a look at more javaScript snippets from this application