Show / Hide markers in geoxml3.js

2,491 views
Skip to first unread message

kpietru

unread,
Aug 3, 2010, 7:20:02 PM8/3/10
to Google Maps JavaScript API v3
Is it possible to use toggle (show or hide the markers) in geoxml3.js?

http://sterlingudell.com/geoxml3/markers.html


---

kpietru

unread,
Aug 9, 2010, 5:50:42 AM8/9/10
to Google Maps JavaScript API v3


This script does not work for geoxml3.

Hide markers:
geoXml.hideDocument (geoXml.docs);

Do you have any ideas?

ebakunin

unread,
Aug 13, 2010, 1:36:12 PM8/13/10
to Google Maps JavaScript API v3
Bump. I have the same problem and would really appreciate some advice.
Thanks.

Rossko

unread,
Aug 13, 2010, 2:39:39 PM8/13/10
to Google Maps JavaScript API v3
> Hide markers:
> geoXml.hideDocument (geoXml.docs);
>
> Do you have any ideas?

Guessing, geoXml would need to be in scope when you call that. Any
error reported?
Best approach, as always, show us the patient -
http://groups.google.com/group/google-maps-js-api-v3/t/2b3f101fd509919e

ebakunin

unread,
Aug 13, 2010, 2:49:28 PM8/13/10
to Google Maps JavaScript API v3
My situation is that I'm dealing with a *lot* of markers and
MarkerManager.js was not speedy enough. Using kml files is much more
efficient. In the code below you'll see that different kml files are
loaded according to the map's zoom level. Everything works great.
However, I can't remove the kml layer once it's been applied, which is
necessary to duplicate MarkerManager's functionality.

Here's the reference page for geoXML3: http://code.google.com/p/geoxml3/wiki/ParserReference

Thanks a lot for the help.

function getSystemFile() {
switch (myMap.getZoom()) {
case (MIN_ZOOM + 1):
system_file = '3025-2.xml';
break;
case (MIN_ZOOM + 2):
system_file = '3025-3.xml';
break;
case (MIN_ZOOM + 3):
system_file = '3025-4.xml';
break;
default:
system_file = '3025-1.xml';
}
return system_file;
}

function initialize() {

...yada yada...

var myParser = new geoXML3.parser({
createMarker: addMyMarker,
map: myMap,
processStyles: true,
singleInfoWindow: true,
zoom: false
});
myParser.parse(getSystemFile());

google.maps.event.addListener(myMap, 'zoom_changed', function() {
myParser.parse(getSystemFile());
});

function addMyMarker(placemark) {
myParser.createMarker(placemark);

Rossko

unread,
Aug 13, 2010, 9:06:37 PM8/13/10
to Google Maps JavaScript API v3
> However, I can't remove the kml layer once it's been applied, which is
> necessary to duplicate MarkerManager's functionality.

I can't see anywhere in your code snippet where you get or keep any
reference to the document you want to hide, nor any attempt to hide
it.
myParser.docs is an array
myParser.hideDocument() expects a single doc, its up to you to select
the one you want

addMyMarker() appears to be in a local scope, I'm amazed it works like
that.

Let us know when the patient is ready to be examined.

kpietru

unread,
Aug 15, 2010, 1:12:43 PM8/15/10
to Google Maps JavaScript API v3
My problem was solved:

Hide markers in geoxml3 http://www.geocontext.org/pliki/2010/test-geoxml3/test2/

The solution comes from the Polish forum for Google Maps:
http://www.goldenline.pl/forum/1852722/maps-api-v3-i-skrypt-geoxml3-pokaz-ukryj-markery
Reply all
Reply to author
Forward
0 new messages