how 2 add event triggers to a czml defined route

Using the CZML example from the site as a reference, specifically the vehicle route; I’d like to have an event trigger occur when the “vehicle” passes a certain point so I can “pop-up” an HTML container (

). Does this functionality already exists in the program? If so can you point me to (or provide) some sample code on setting this up?

I’d also be interested in how to attach a custom handler to an onclick event for a “pinhead”.

Hi Maynard,

We don’t currently have native support for exactly that, but here’s a quick code example that listens for a entity passing a particular point by checking distance per frame. It’s by no means perfect, but it might work for your use case:

As for onclick for a point or a billboard, look at our picking example – it should give you exactly what you need:

Hope that helps,

  • Rachel

Thanks, the first example you suggested gave me what I was looking for concerning creating some sort of proximity detector.

For the second part of the question I was looking for how to “load/open” an entity’s infobox using javascript. Since I’m having a couple of issues with accessing the pinhead entity I’ll post it as a separate post.