Categories: Windows : How Do I...? :

Dynamically create circles of set distance from a placemark?

Showing 1-11 of 11 messages
Dynamically create circles of set distance from a placemark? Wrathernaut B. Hear 7/19/10 1:20 AM
I have created in Google Maps (on a separate network running an enterprise edition of google maps) a KML file that has html form input buttons on various placemarks that, when clicked, execute javscript code to draw a circle around the selected placemark.

I wish to have the same functionality available when people download the same KML file that is used on google maps, is it possible?
Re: Dynamically create circles of set distance from a placemark? barryhunter 7/19/10 3:26 AM
As far as I know there is not 'enterprise' version of Google Maps itself, only the Google Maps API. That doesnt provide a fully working website, its implemented by you (or your developers) 


So really this question is how to program this yourself? Persumably your javascript creates the KML somehow, so just need to extend it to also export the circles. 

Because we persumably cant access your map, we cant really tell you how to do that. 
Re: Dynamically create circles of set distance from a placemark? Wrathernaut B. Hear 7/19/10 6:22 AM
No, it works just fine in the version of google maps running on the separate network, that's not the problem.

I want to have, within the info balloon for a placemark in Google Earth, a button or link that will place a range ring/circle around it.
Re: Dynamically create circles of set distance from a placemark? Wrathernaut B. Hear 7/19/10 6:29 AM
I don't want to export the circles, as there are several hundred placemarks, each with buttons to turn on/off range rings.

I guess an example would be to have a list of all McDonalds in a KML, and a KML full of hotels in another. To see quickly which McDonalds are within 10 or 20 miles from the hotel, there's a button in the hotel's info balloon to turn on/off the range rings. This works just fine using javascript to turn on/off polylines built using one of various circle generators for Google Maps, but I need a way to do this in Google Earth as well.
Re: Dynamically create circles of set distance from a placemark? barryhunter 7/19/10 6:57 AM
Ah, ok dont think its really possible to do the same in Google Earth desktop.

You would need to create circles in the KML file, but http://www.sgrillo.net/googleearth/gepath.htm might help if dont want to do it yourself. 


Or use the Google Earth API to embed the Plugin into a webpage, then can use javascript to create circles in much the same way.  


Re: Dynamically create circles of set distance from a placemark? Wrathernaut B. Hear 7/21/10 12:45 AM
Just had an idea with this, might be a little out-of-the-box.

Could I put a hyperlink in the info balloon, which sends the size and center point of the circle to a webpage that reads those parameters and outputs a KML file which google earth loads? Would be like:
href="mypage.com/kmlCircle.html?size=10&lat=33&long=66&color=blue"

Which would just return with document.write a complete .kml file.

Worth a shot anyway.
Re: Dynamically create circles of set distance from a placemark? barryhunter 7/21/10 2:28 AM
Can try it, a script here you can use:




The problem being that GE doesnt tend to load KML links in balloons very well. 


Re: Dynamically create circles of set distance from a placemark? barryhunter 7/21/10 2:31 AM
... or at least it did. Just tried it with 5.2 - it actully worked quite smooth. 

Previous versions would goto the standalone browser, which would then prompt what to do with file, then you have click to load it in GE. 
Re: Dynamically create circles of set distance from a placemark? Wrathernaut B. Hear 7/22/10 12:08 AM
Tried loading a KML with a link, works in 4.2 as well. Now I just need to get the source to that nearby.org.uk site.
Re: Dynamically create circles of set distance from a placemark? barryhunter 7/22/10 3:04 AM
http://www.nearby.org.uk/google/circle.kml.phps

:)
Re: Dynamically create circles of set distance from a placemark? Wrathernaut B. Hear 7/28/10 4:40 AM
Well, I more or less got it working, but I must have something wrong with the headers. If I load a static KML file from my webpage with the link, it works great, if I load somebody else's dynamic page (trying to find out what headers they're using) it also works, but loading my own dynamic page causes GE to open up my web browser with the save/open dialog.

If I put these same dynamic KML links as network links, they work fine in GE, but cause google maps to fail with the same KML.