using gdownloadurl/xml to create markers...want to open other infowindows from link inside infowindow‏

117 views
Skip to first unread message

shadrack

unread,
Sep 7, 2010, 10:33:32 AM9/7/10
to Google Maps JavaScript API v3
I've recently finished converting a map to work in v3. Its here:
http://julieshad.com/ag/map_v3.html. And the xml is here:
http://julieshad.com/ag/markers.xml.
I now have another hurdle to cross involving connecting/displaying a
relationship between some of the markers via data that is in the xml.

When the user clicks on a marker and an infowindow pops up, I want to
have a link inside the infowindow so when the user clicks on the link,
a specific marker's infowindow is opened in addition to one the user
has already chosen to open. I've seen some posts and examples that
touch on this subject, but after trying several methods unsuccesfully,
I thought I'd ask the experts.

The concept I thought would work would be to push the markers and
associated attributes (from xml file) as I generate them into an
array, so I could have marker[1], marker[2], marker[3] and so on. In
the xml data, I would connect markers through an attribute. So, if I
want marker[1] to have a link inside the infowindow that opens
marker[3]'s infowindow in addition, I would simply add an attribute in
marker[1]'s data that has marker[3]. Then, I could include in the
link a function that opens the associated marker, like:

function openNewLoc() {
GEvent.trigger(marker[1],"click");
}

Of course, marker[1] would be a variable (i.e. connected_marker)
that's an attribute of the marker, derived from the xml...like:

function openNewLoc() {
GEvent.trigger(connected_marker,"click");
}

But I'm not sure if I'm way off, or on the right track. And how do I
implement something like this? I know the syntax for pushing elements
into an array, but I've been unsuccessful trying it in the confines of
the map I'm using.

Thanks so much for your time, and I'll gladly clarify any points that
are confusing,

geoco...@gmail.com

unread,
Sep 7, 2010, 5:33:16 PM9/7/10
to Google Maps JavaScript API v3
Is this something like what your are trying to do?

http://www.geocodezip.com/v3_polyline_example_geodesic_proj.html

Each of the small red markers has a prev - next link that "clicks" on
the next marker. It doesn't use xml, but you can modify your xml (or
you code) to do something similar.

-- Larry

shadrack

unread,
Sep 7, 2010, 11:09:29 PM9/7/10
to Google Maps JavaScript API v3
Thanks...I will give that a try tonight or tomorrow. It looks
reasonable. I guess the important part to index the markers is the
"gmarkers.push(marker);
" part of the code and then the

"function myclick(index) {
google.maps.event.trigger(gmarkers[index],"click");
}"
?

I'll try it out and let you know how it goes...thanks!

Shad

On Sep 7, 2:33 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:

shadrack

unread,
Sep 17, 2010, 12:04:14 AM9/17/10
to Google Maps JavaScript API v3
Thanks very much! I used that concept to open other markers from a
link on the sidebar...the code I settled with that works is
here...http://julieshad.com/ag/map_v3.2.html
Reply all
Reply to author
Forward
0 new messages