How to load and control KML

52 views
Skip to first unread message

tlep

unread,
Jun 12, 2008, 9:35:54 AM6/12/08
to KML Developer Support - Google Earth Browser Plugin

Clearing the muddy waters on this subject, here's how to load and
control KML, whether a NetworkLink, or anything else in the KML:

var myKMLObject;

function finishedSectors(object) {

if (!object) {
alert('bad or NULL kml');
return;
}

myKMLObject = object;

ge.getFeatures().appendChild(object);

}


function loadMyKML() {

var url = "http://localhost/foo/sectors4.kmz";
google.earth.fetchKml(ge, url, finishedSectors);

}


function hideMyKMLObject() {

if (myKMLObject) {

myKMLObject.setVisibility( false );

}

}




function removeMyKMLObject() {

if (myKMLObject) {

ge.getGlobe().getFeatures().removeChild(myKMLObject);

}

}


Gerardo64

unread,
Jun 12, 2008, 12:05:42 PM6/12/08
to KML Developer Support - Google Earth Browser Plugin
Hi. I´m still in the muddy waters...

Can you make an example where you have two check boxes to show/delete
from the map two kml files?
Could you load an example page showing this, please?

Thanks! (I think we a re a bunch of people who would like to get this
clear...)

Gerardo

Tony GIS

unread,
Jun 12, 2008, 2:16:26 PM6/12/08
to KML Developer Support - Google Earth Browser Plugin
Have to agree with Gerardo. Although the processing of examples
showing processing/creating/accessing kmls between such programs as
ArcMap and Google Earth Desktop version are vast; I know a great many
where I'm at where we would like to see you KML guru's show off some
talent with some accessible examples. Personally, I love the plugin
and can see great potential for the use of KML's (especially since it
was recently accepted at the OGC as standard), and bow down to you
gurus who have made use of the kmls.

Best regards,
Tony

dorjee

unread,
Jun 13, 2008, 12:13:23 PM6/13/08
to KML Developer Support - Google Earth Browser Plugin
I agree with Tony. The bad teacher is closed in his mind and can't
imagine what is in the mind of his pupil. He think that everybody is
like him an expert in JS scripting, giving a bit of script and
thinking that it is understood that everybody knows where to put it.

A good example should be a full <html>to</html> code. I am always
waiting for it to display a kmz file from its url...

tlep

unread,
Jun 13, 2008, 12:36:12 PM6/13/08
to KML Developer Support - Google Earth Browser Plugin

Nobody is getting paid to post here. I was hoping to give a boost to
my contemporaries, not be a teacher.

ddavid

unread,
Jun 13, 2008, 3:40:05 PM6/13/08
to KML Developer Support - Google Earth Browser Plugin

Because I studied the example code and demos before being spoon fed on
the forum, I understood your post perfectly. I also undestand basic
HTML and javascript, so maybe that helped.

Thanks!
david

Matt Fox

unread,
Jun 13, 2008, 7:46:22 PM6/13/08
to KML Developer Support - Google Earth Browser Plugin
Here is an example of what you are trying to do.

http://www.barnabu.co.uk/geapi/test/checkboxes.html

dorjee

unread,
Jun 14, 2008, 5:28:39 PM6/14/08
to KML Developer Support - Google Earth Browser Plugin
Thanks a lot for this FULL example. It is enlighting!

jpwade_bsu

unread,
Jun 15, 2008, 7:59:47 AM6/15/08
to KML Developer Support - Google Earth Browser Plugin
thanks Matt,

setVisibility works fine, tried a sample without flaw from your
example

http://czmartin.com/jpw/asp_arcmap/gem_3d_netlink_multiples.html

point
line
polygon
overlay
3d

jpwade_bsu

unread,
Jun 15, 2008, 8:28:19 AM6/15/08
to KML Developer Support - Google Earth Browser Plugin
yes, its amazing how many post snipplets with out functional page
examples .... or no reply back from users that ask "can you post a
sample page" ....

at any rate, check matt fox's post in this thread for a setvisibility
example page

jpwade
www.czmartin.com/jpw
> > > }- Hide quoted text -
>
> - Show quoted text -

fraser

unread,
Jun 16, 2008, 12:24:34 AM6/16/08
to KML Developer Support - Google Earth Browser Plugin
Hey

I think there is a bug with either removeChild() or fetchKml(), I
suspect fetchKml()....
Even the code in the first post doesn't work. If you run the
sequence..

loadMyKML();
removeMyKMLObject();
loadMyKML();

Then all the placemarks from the kml are duplicated. That is you have
a set for each loadMyKml.
It's like either removeMyKMLObject
(ge.getGlobe().getFeatures().removeChild(myKMLObject);) doesn't really
remove the placemarks
Or loadMyKML (google.earth.fetchKml(ge, url, finishedSectors);) is
caching the result somehow.

I have made a page outlining and detailing the bug here.

http://www.simpsonhaugh.com/SimpsonHaugh/map/fetchKml_bug.html
> > - Show quoted text -- Hide quoted text -

Muhammad Zeeshan Awan

unread,
Jun 16, 2008, 6:00:38 AM6/16/08
to KML Developer Support - Google Earth Browser Plugin
Can you give the link from where i can download Shape to KML from
ArcMap

larso

unread,
Jun 16, 2008, 6:16:27 AM6/16/08
to KML Developer Support - Google Earth Browser Plugin
http://arcscripts.esri.com/details.asp?dbid=14273
> > - Show quoted text -- Hide quoted text -

twhitley

unread,
Jun 16, 2008, 9:48:31 AM6/16/08
to KML Developer Support - Google Earth Browser Plugin
Hi folks,

Just want all to know I wasn't trying to bad mouth anyone. In fact, I
appreciate all those who are trying to share their knowledge. Just a
bit of frustration on my part - so again I apologize.

twhitley

unread,
Jun 16, 2008, 9:59:08 AM6/16/08
to KML Developer Support - Google Earth Browser Plugin
Two options for you;

Esri arcsripts page; do a search for kml: http://arcscripts.esri.com/:
this works well for the most part but when I tried a large shapefile
such as parcels there are issues.


This option works really well: www.zonums.comshp2kml.html
Reply all
Reply to author
Forward
0 new messages