Re: Help with filtering markers.

23 views
Skip to first unread message
Message has been deleted

geoco...@gmail.com

unread,
Oct 26, 2010, 9:16:59 AM10/26/10
to Google Maps JavaScript API v3
On Oct 26, 6:11 am, Paul Rutt <therutts...@googlemail.com> wrote:
> I'm trying to get to grips with the Google Map API V3. I've got so
> far but struggling with the filtering function see function marked
> red. Any help would be appreciated. Thanks.

Please read the posting guidelines:
http://groups.google.com/group/google-maps-js-api-v3/browse_frm/thread/2b3f101fd509919e

The code that you posted to the group:
1. is mangled
2. can't be run in a debugger
3. doesn't have any function marked in red

-- Larry

Paul Rutt

unread,
Oct 26, 2010, 9:40:31 AM10/26/10
to google-map...@googlegroups.com
Hi Larry,

Don't know what you mean with regards to 'mangled', have no idea what debugger your using and the text is in red in my post?

Here is a link to the live page:mySample

Kind regards Paul.

geoco...@gmail.com

unread,
Oct 26, 2010, 9:49:36 AM10/26/10
to Google Maps JavaScript API v3
On Oct 26, 6:40 am, Paul Rutt <therutts...@googlemail.com> wrote:
> Hi Larry,
>
> Don't know what you mean with regards to 'mangled', have no idea
> what debugger your using and the text is in red in my post?

See how it appears in the group interface:
http://groups.google.com/group/google-maps-js-api-v3/browse_frm/thread/e7b260917803cabb#

-- Larry
Message has been deleted

geoco...@gmail.com

unread,
Oct 26, 2010, 10:33:57 AM10/26/10
to Google Maps JavaScript API v3
On Oct 26, 7:12 am, Ruttstar <therutts...@googlemail.com> wrote:
> Hi Larry:
>
> Don't know why the red isnt showing, its the function:

Because it is the groups interface.

>
> document.getElementById("change").onclick = function()
> {
> alert(markers.length);
> for( i=0;i<markers.length;i++)
> {
> markers[i].setVisible(map.markers[i].type == 'Restricted');
>
>
>
> }
> alert("Success");
> }
> }
>
> Dont know why link didnt show either:


http://www.s218287072.websitehome.co.uk/sample.php

Because it is the groups interface.

I get obvious javascript errors on that link.

Both your map and markers variables are local to your load function.
They need to be global to be accessible to javascript run from html.

-- Larry


>
> On Oct 26, 2:49 pm, "geocode...@gmail.com" <geocode...@gmail.com>
> wrote:
>
>
>
> > On Oct 26, 6:40 am, Paul Rutt <therutts...@googlemail.com> wrote:
>
> > > Hi Larry,
>
> > > Don't know what you mean with regards to 'mangled', have no idea
> > > what debugger your using and the text is in red in my post?
>
> > See how it appears in the group interface:http://groups.google.com/group/google-maps-js-api-v3/browse_frm/threa...

Paul Rutt

unread,
Oct 26, 2010, 10:54:13 AM10/26/10
to google-map...@googlegroups.com
I appreciate you taking time to help Larry, im new at this which must be frustrating to people like yourself.

Ive made both map and markers global as per the previous link and get same lack of results.

Regarding js errors whats best to debug in as a newbie, i have firebug but not sure how to debug js with it.

Paul.

geoco...@gmail.com

unread,
Oct 26, 2010, 11:12:42 AM10/26/10
to Google Maps JavaScript API v3
On Oct 26, 7:54 am, Paul Rutt <therutts...@googlemail.com> wrote:
> I appreciate you taking time to help Larry, im new at this which must
> be frustrating to people like yourself.
>
> Ive made both map and markers global as per the previous link and get
> same lack of results.

I still get an error:
Line: 78
Error: 'map.markers' is null or not an object

I think that should be "markers" not map.markers.

-- Larry

>
> Regarding js errors whats best to debug in as a newbie, i have firebug
> but not sure how to debug js with it.

Look at the Error Console (Ctrl-J or Ctrl-Shift-J I don't remember or
Tools:Error Console)


>
> Paul.

Paul Rutt

unread,
Oct 26, 2010, 11:44:11 AM10/26/10
to google-map...@googlegroups.com
Yes I've spotted that and amended it but still get:

markers[i].setVisible is not a function

in the console?

geoco...@gmail.com

unread,
Oct 26, 2010, 1:17:36 PM10/26/10
to Google Maps JavaScript API v3
On Oct 26, 8:44 am, Paul Rutt <therutts...@googlemail.com> wrote:
> Yes I've spotted that and amended it but still get:
>
> markers[i].setVisible is not a function

markers is an array of XML DOM elements, they don't have .setVisible
methods.

You need to create an array of the google.maps.Marker objects you
create if you want to affect them after they have been created.

See:
http://www.geocodezip.com/v3_MW_example_map3.html
for an example that does that.

-- Larry

>
> in the console?
Message has been deleted

geoco...@gmail.com

unread,
Oct 26, 2010, 2:46:13 PM10/26/10
to Google Maps JavaScript API v3
On Oct 26, 11:07 am, Paul Rutt <therutts...@googlemail.com> wrote:
> Thanks Larry your a star,
>
> The names of the arrays had confused me, now you've pointed that out it
> seems to make more sense and I've got it working:
>
> http://www.s218287072.websitehome.co.uk/sample.php
>
> Does this look ok to you?

It seems to work as I would expect, and I don't get errors doing the
things I did.

Is that what you are asking?

-- Larry

>
> Paul

Paul Rutt

unread,
Oct 26, 2010, 2:53:29 PM10/26/10
to google-map...@googlegroups.com
Yes, thanks again.
Reply all
Reply to author
Forward
0 new messages