I have created a map which uses two kml files, one created dynmically
from a Mysql DB for the markers, one from a flat KML file for polygons
of regions.
I am using Lance's geoXML which easily gave me a nice sidebar of the
polygon regions and combined it with various of Mike's tutorial on how
to create a sidebar for the markers, turning them on and off.
Works great. But now I want to combine the two. What I want to do now
is, when a user clicks to hide region 1, all markers in the polygon of
region 1 are hidden as well.
But for the life of me I have been unable to do this. I want to do
this on the client side. Note they are in different files and
unrelated in any way other than geographically. IE the markers in the
arker file don't "know" what region they are in.
Unfortunately the map is on a development server, so I can't show it
just yet , but if someone can point me to an example I can use as a
base to teach myself - that would be great.
Note I have read the epoly example and can still not apply it to this
instance. Do I have to do another loop after getting the
region.contains and put the marker.points there?
<code>
GEvent.addListener(map, "click", function(overlay, point,
overlaylatlng) {
if(overlay) { // ok i have clicked in a region overlay
GLog.write("overlay = " +overlay.name+ " and overlaylatlng = "
+overlaylatlng); // debug
for (var i=0; i<regions.overlayman.markers.length; i++) {
// count the regions returned from geoXML
if (regions.overlayman.markers[i].Contains(overlaylatlng)) {
// does it contain the point clicked int he region overlay
GLog.write(regions.overlayman.markers[i].name + " contains
these points...");
// debug - another loop here for the markers from the other
file?
}
}
} else {
GLog.write("point = " +point);
}
});
</code>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.