Account Options

  1. Sign in
Google Groups Home
« Groups Home
Show Hide Markers using Marker Manager
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
coreykliewer  
View profile  
 More options Sep 13 2007, 3:47 pm
From: coreykliewer <coreyklie...@gmail.com>
Date: Thu, 13 Sep 2007 19:47:38 -0000
Local: Thurs, Sep 13 2007 3:47 pm
Subject: Show Hide Markers using Marker Manager
when zooming in or out of your maps after hiding them using
MarkerManager the markers re-appear.

I used Mike William's hack

  me.addOverlay_ = function(marker) {
    map.addOverlay(marker);
    if (marker.isHidden()){marker.show();marker.hide()}
    me.shownMarkers_++;
  };

And it worked about a month ago - now its not working. Is anyone else
using this hack and has it stopped working?

I also see that this issue is listed as a bug, but its been there for
a while - does google plan to fix this or should I dump the
markermanager and just go with removeOverlay?

Corey


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pamela (Google Employee)  
View profile  
 More options Sep 13 2007, 4:54 pm
From: "pamela (Google Employee)" <pamela....@gmail.com>
Date: Thu, 13 Sep 2007 20:54:24 -0000
Local: Thurs, Sep 13 2007 4:54 pm
Subject: Re: Show Hide Markers using Marker Manager
Hi Corey,

I believe there was a recent change in behavior where a marker that
has been removed will have it's hidden-ness reset. It was more of a
design decision than a bug. A marker.setVisible() function would make
more sense in this situation.
Anyway, I would suggest the following:
1) Whenever you call marker.hide(), say marker.pleaseHideLater = true
2) In the addOverlay_ function you quoted, have:
if (marker.pleaseHideLater) { marker.hide() }
3) Whenever you call marker.show(), say marker.pleaseHideLater = false

I haven't tried that out, but I believe it should work (and not be as
subject to API changes). Sorry for the hassle.
- pamela

On Sep 14, 5:47 am, coreykliewer <coreyklie...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Papa Bear  
View profile  
 More options Sep 13 2007, 6:00 pm
From: Papa Bear <papabear.newy...@gmail.com>
Date: Thu, 13 Sep 2007 22:00:05 -0000
Local: Thurs, Sep 13 2007 6:00 pm
Subject: Re: Show Hide Markers using Marker Manager
I don't want to hijack this thread, but in tests I did with moderate
numbers of markers (hundreds to several thousand) I found
that .addMarkers(...) and .clearMarkers() were considerably more
efficient that .show()/.hide() (yes with Mike's so-called hack).
Developers might just want to consider this approach and do some
testing for their own situation.

I create multiple instances of the MM so each class of my markers
would have it's own MM.  This way I could turn them on or off
independently.  Obviously with show()/hide() you can do something
similar.

Regards
Richard aka Papa Bear

On Sep 13, 4:54 pm, "pamela (Google Employee)" <pamela....@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
coreykliewer  
View profile  
 More options Sep 14 2007, 6:55 am
From: coreykliewer <coreyklie...@gmail.com>
Date: Fri, 14 Sep 2007 10:55:14 -0000
Local: Fri, Sep 14 2007 6:55 am
Subject: Re: Show Hide Markers using Marker Manager
Nope that didnt work - but I will play and try to figure out how to
get that to work.

If I get any positive results I will add to this thread.

On Sep 13, 4:54 pm, "pamela (Google Employee)" <pamela....@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
coreykliewer  
View profile  
 More options Sep 14 2007, 6:55 am
From: coreykliewer <coreyklie...@gmail.com>
Date: Fri, 14 Sep 2007 10:55:54 -0000
Local: Fri, Sep 14 2007 6:55 am
Subject: Re: Show Hide Markers using Marker Manager
Richard,

Would you happen to have an example? Would love to see how it works
for you.

Corey

On Sep 13, 6:00 pm, Papa Bear <papabear.newy...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
coreykliewer  
View profile  
 More options Sep 14 2007, 8:49 am
From: coreykliewer <coreyklie...@gmail.com>
Date: Fri, 14 Sep 2007 12:49:00 -0000
Subject: Re: Show Hide Markers using Marker Manager
Pamela -

Yes it did work, thank you!

It was a small error on my part, that didnt have it working correctly
- your instructions worked perfectly.

Richard -

I would still like to see your example, I am intrigued to see how you
handle it.

Thanks

Corey

On Sep 13, 4:54 pm, "pamela (Google Employee)" <pamela....@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Papa Bear  
View profile  
 More options Sep 14 2007, 1:32 pm
From: Papa Bear <papabear.newy...@gmail.com>
Date: Fri, 14 Sep 2007 17:32:38 -0000
Local: Fri, Sep 14 2007 1:32 pm
Subject: Re: Show Hide Markers using Marker Manager
Hi Corey

Here's what I do:

>  I put a control button on the map to show or hide a class of markers
>  the button calls a toggle function  The toggle will either turn them on or off. It has 4 arguments: 1) "hide" (boolean) - which tells it to hide or show the markers, 2) "MM" (object) - the instance of the Marker Manager for this class of markers, 3) "markers" - the array of markers generated when I created the markers the first time, and 4) "zoom" (number) - the zoom level for this class.  Note that the "show" functionality is exactly the same as when the markers are added the first time.

Like this (slightly simplified for this note):

function toggleMarkers(hide, MM, markers, zoom) {
  if (hide) {
    MM.clearMarkers();
  }
  else {
    MM.addMarkers(markers,zoom)
    MM.refresh()
  }

}

My actual code is a bit harder to understand since the Marker Manager
names and the array names use the color of the marker as part of the
name, so there's a bunch of eval() functions in there.

Here's a sample:
http://www.stuyvesantcove.org/benchmarking/BM_Benchmarking.html?index...

You should see a map of Brooklyn New York.  There are an assortment of
red, green and white markers on the map.  There is a control button on
the top left labelled "Toggle Markers, Labels On/Off".  Put the mouse
over that button and you will see a drop down list.  Click on the list
items to turn on or off markers of a particular color. As long as you
keep the mouse over the list, you can click them on or off to your
heart's content.  As for performance, the red show all in that class
(78).  The green and White are cluster markers which represent over a
hundred (actual 106 green  and  170 white). The cluster markers plus
the underlying markers are all in the Marker Manager at appropriate
zoom levels.   I have other maps with up to 3500 markers and the
performance is not too bad.

(Try this, my worst case):
http://www.stuyvesantcove.org/benchmarking/BM_Benchmarking.html?index...

As I said, the real code is a bit complex (by all means look at it if
you like) but the functions shown in this not is the esense of it.

Glad you got things working and I hope this helps.

Regards
Richard aka Papa Bear

On Sep 14, 8:49 am, coreykliewer <coreyklie...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
coreykliewer  
View profile  
 More options Sep 14 2007, 4:55 pm
From: coreykliewer <coreyklie...@gmail.com>
Date: Fri, 14 Sep 2007 20:55:00 -0000
Subject: Re: Show Hide Markers using Marker Manager
Ok, I hope I'm not confusing here - but I found a better way to manage
the hide markers!

The problem with the the above solutions is that when you zoom out all
the markers do a quick flash appearance and then they disappear when
the addOverlay_ function is called - so what I did was this

I changed the addOverlay_ function to this:

me.addOverlay_ = function(marker) {
        if (!marker.pleaseHideLater) {map.addOverlay(marker);}
    me.shownMarkers_++;
  };

And where I call marker.show() I do a map.overlay(marker); so that
line reads
map.addOverlay(marker);
marker.show();
marker.pleaseHideLater = false;

and whereever I call marker.hide() I also keep the
marker.pleaseHideLater = true statement that Pamela stated above.

Now your map cleanly shows and hides your markers without any flashing
markers when you zoom in and out

Hope this helps who ever is looking for this.

Corey

On Sep 13, 4:54 pm, "pamela (Google Employee)" <pamela....@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
papabear.newyork  
View profile  
 More options Sep 14 2007, 5:37 pm
From: " papabear.newyork" <papabear.newy...@gmail.com>
Date: Fri, 14 Sep 2007 17:37:03 -0400
Local: Fri, Sep 14 2007 5:37 pm
Subject: Re: Show Hide Markers using Marker Manager

Hi Cory

I'm not sure you're referring to my example or not, but if you are, you may
be confusing the hide/show function with the marker manager functionality.

> when I hide a marker with my control button, it stays hidden regardless of

zoom level, it does not flash in and out of vivibility when you change zoom
level.

> when you use the cluster markers in my example to zoom in, it does nothing

more than zoom in (or out, as the case may be).  The logic of the marker
manager is responsible for the flashing affect and that has nothing to do
with the hide/show logic.

The hide/show scheme you are putting together seems sound.  The suggestion
of my scheme which uses addMarkers/clearMarkers is simply  an alternative
that may have performance advantages in certain situations.

Regards
Richard aka Papa Bear

On 9/14/07, coreykliewer <coreyklie...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »