Marcelo,

I've done what you suggested above and it's working now! A big thanks
for your help.

I implemented the if/else statement from your first response to turn
the polygon on and off.
This worked in a way that the marker needed to be clicked a second
time to turn the poly off, regardless of the info window state.
To remedy this I added another event listener to watch for the closing
of the info window and used this to close the visible polygon in place
of the if/else.
I don't know if this is the most efficient way of doing this but it re-
hides the polygon on closing the info window. It's still possible to
click the marker a second time to hide the poly but I got the effect I
was after!

I've updated the page with the new code so you can have a look if
you're interested.

Once again, many thanks for your assistance with this.

Cheers,
-Andrew

On 27 Oct, 14:25, Marcelo <[email protected]> wrote:
> On Oct 27, 1:39 pm, Andyroo1000 <[email protected]>
> wrote:
>
>
>
> > So, I then change the line:
> > var marker = new GMarker(point, customIcons[Year]);
> > to read
> > var marker = new GMarker(polygons, point, customIcons[Year]);
>
> I wrote "You could add the polygon to its marker as a property", and
> what that means, (in pseudo-code), is:
>
> var poly = createPolygon( param1,param2, ...);
> map.addOverlay(poly);
> poly.hide();
>
> var marker = createMarker( param1,param2, ...);
> map.addOverlay(marker);
> marker.myPolygon = poly;
>
> function createPolygon( param1,param2, ...){
>   var poly = new GPolygon( .... );
>   return poly;
>
> }
>
> function createMarker( param1,param2, ...){
>   var marker = new GGMarker( .... );
>   return marker;
>
> }
>
> The marker object now has a **property** called myPolygon, which holds
> your GPolygon object.
> Then in the click event handler you can access the correct polygon
> with
>
> marker.myPolygon.show();
>
> --
> Marcelo -http://maps.forum.nu
> --
>
>
>
> > This stops the markers appearing at all, giving the JS error " 'x' is
> > null or not an object "
>
> > This is where I get stuck..!
>
> > -Andrew
>
> > On 27 Oct, 12:04, Marcelo <[email protected]> wrote:
>
> > > On Oct 27, 10:11 am, Andyroo1000 <[email protected]>
> > > wrote:
>
> > > > When you view the page map.php it creates a session with year, easting
> > > > and northing data in it.
> > > > Again, this is tested an working correctly...
>
> > > Aha!
> > > ... and do you know why I couldn't see the markers?
> > > Because I don't accept cookies, so the session information wasn't
> > > saved.
>
> > > So, it is tested and working correctly **IF** the visitor accepts
> > > cookies. :-)
>
> > > Now, back to your original question, I see that you *STILL* have made
> > > no attempt at implementing what I suggested in my first post on this
> > > thread.
> > > Would you like to give it a try?
>
> > > --
> > > Marcelo -http://maps.forum.nu
> > > --
>
> > > > -Andrew
>
> > > > On 26 Oct, 14:04, Marcelo <[email protected]> wrote:
>
> > > > > On Oct 26, 2:37 pm, Andyroo1000 <[email protected]>
> > > > > wrote:
>
> > > > > > The map.php page passes coordinate and year info to the 
> > > > > > output-xml.php
>
> > > > > No, it doesn't. You are calling output-xml.php from the line:
> > > > >   GDownloadUrl("output-xml.php", function(data) { ...
> > > > > and there are no parameters in that request.
>
> > > > > --
> > > > > Marcelo -http://maps.forum.nu
> > > > > --
>
> > > > > > page which returns the formatted XML. Going straight to 
> > > > > > output-xml.php
> > > > > > will show an error in the MySQL query.
>
> > > > > > I tried to implement what you suggested but I think I must have been
> > > > > > putting it in the wrong place as the polygons stopped appearing,
> > > > > > leaving just the markers on the map.
> > > > > > I moved it round, got errors, moved it round some more, got just
> > > > > > markers and couldn't get it to show the polygons on marker clicks no
> > > > > > matter what I tried.
> > > > > > I took what I edited out so that it displayed both the markers and 
> > > > > > the
> > > > > > polygons and you can see what is being passed to the map.
>
> > > > > > Please have another look, let it churn away and you should see what 
> > > > > > I
> > > > > > mean.
>
> > > > > > Cheers,
> > > > > > -Andrew
>
> > > > > > On 26 Oct, 12:32, Marcelo <[email protected]> wrote:
>
> > > > > > > ... but I don't see any markers on that map, or any attempt at
> > > > > > > implementing what I suggested in my previous post.
>
> > > > > > > Start by fixing your PHP, so that you can get some markers on the 
> > > > > > > map:http://www.bluesky-world.com/dev_area/output-xml.php
>
> > > > > > > Then *try* to implement what I suggested earlier, and if you 
> > > > > > > can't get
> > > > > > > it to work then post to the forum again.
>
> > > > > > > --
> > > > > > > Marcelo -http://maps.forum.nu
> > > > > > > --
>
> > > > > > > On Oct 26, 10:45 am, Andyroo1000 <[email protected]>
> > > > > > > wrote:
>
> > > > > > > > Of course, my apologies..!
>
> > > > > > > >http://tinyurl.com/yfjkqns
>
> > > > > > > > -Andrew
>
> > > > > > > > On 23 Oct, 11:20, Marcelo <[email protected]> wrote:
>
> > > > > > > > > On Oct 23, 12:10 pm, Andyroo1000 
> > > > > > > > > <[email protected]>
> > > > > > > > > wrote:
>
> > > > > > > > > > Suggestions welcome!!
>
> > > > > > > > > Suggestion:
> > > > > > > > > Please read and follow the group's posting 
> > > > > > > > > guidelines:http://groups.google.com/group/Google-Maps-API/web/suggested-posting-......
>
> > > > > > > > > --
> > > > > > > > > Marcelo -http://maps.forum.nu
> > > > > > > > > --
>
> > > > > > > > > > -Andrew
>
> > > > > > > > > > On 22 Oct, 18:45, Marcelo <[email protected]> wrote:
>
> > > > > > > > > > > On Oct 22, 6:14 pm, Andyroo1000 
> > > > > > > > > > > <[email protected]>
> > > > > > > > > > > wrote:
>
> > > > > > > > > > > > Does anyone know of any way of doing this?
>
> > > > > > > > > > > hmmm ...I wonder if anyone knows.
> > > > > > > > > > > You happen to be in a group dedicated to the Google Maps 
> > > > > > > > > > > API, so I'd
> > > > > > > > > > > put my money on a "yes" for an answer to that question. 
> > > > > > > > > > > ;-)
>
> > > > > > > > > > > You could add the polygon to its marker as a property, 
> > > > > > > > > > > and then add a
> > > > > > > > > > > click event handler that opens the infoWindow, (not 
> > > > > > > > > > > speech bubble),
> > > > > > > > > > > and in that same event handler toggle the polygon with 
> > > > > > > > > > > something like
>
> > > > > > > > > > > if (marker.polygon.isHidden()) {}
> > > > > > > > > > >   marker.polygon.show();
> > > > > > > > > > >   marker.openIngoWindow(html);}
>
> > > > > > > > > > > else {
> > > > > > > > > > >   marker.polygon.hide();
> > > > > > > > > > >   map.closeInfoWindow();
>
> > > > > > > > > > > }
>
> > > > > > > > > > > Of course you'd need to pass the relevant content of the 
> > > > > > > > > > > html variable
> > > > > > > > > > > to the function that creates the marker and attaches the 
> > > > > > > > > > > event
> > > > > > > > > > > listener.
>
> > > > > > > > > > > --
> > > > > > > > > > > Marcelo -http://maps.forum.nu
> > > > > > > > > > > --- Hide quoted text -
>
> > > > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to