I have a large number of markers to display on a map so I want to use GMarkerManager. I see that it has addMarker and addMarkers methods, but is there any way to remove markers from the manager? Or is there any way to "detach" a GMarkerManager from a map? If so I'd just detach the previous GMarkerManager and create a new one with the new markers.
>Would calling clearOverlays() on the map remove all of the markers >managed by the GMarkerManager?
map.clearOverlays() removes the current display of the markers from the map, but the data is still in the GMarkerManager's data, so the next time it performs a manager.refresh() it puts them all back.
A manager.refresh() can happen if you call manager.refresh(), when the zoom level changes, when the map pans far enough for a chunk (1024*1024 pixels) previously outside the [visible region plus borderPadding] comes into view.
> >Would calling clearOverlays() on the map remove all of the markers > >managed by the GMarkerManager?
> map.clearOverlays() removes the current display of the markers from the > map, but the data is still in the GMarkerManager's data, so the next > time it performs a manager.refresh() it puts them all back.
> A manager.refresh() can happen if you call manager.refresh(), when the > zoom level changes, when the map pans far enough for a chunk (1024*1024 > pixels) previously outside the [visible region plus borderPadding] comes > into view.
> > >Would calling clearOverlays() on the map remove all of the markers > > >managed by the GMarkerManager?
> > map.clearOverlays() removes the current display of the markers from the > > map, but the data is still in the GMarkerManager's data, so the next > > time it performs a manager.refresh() it puts them all back.
> > A manager.refresh() can happen if you call manager.refresh(), when the > > zoom level changes, when the map pans far enough for a chunk (1024*1024 > > pixels) previously outside the [visible region plus borderPadding] comes > > into view.
Glad to know I'm not alone. Have there been any clever hacks or workarounds? I only came up with two: 1) don't use GMarkerManager, and 2) add all possible markers to the GMarkerManager.
> You are not alone. Many developers have asked for that and hopefully > Google will provide it in the future releases of the API.
> -dkann
> On Feb 21, 2:29 pm, "Zach Cox" <zcox...@gmail.com> wrote: > > Seems like GMarkerManager.clearMarkers() would be a useful method to > > have in the API (for me at least :) ).
> > On 2/21/07, Mike Williams <nos...@econym.demon.co.uk> wrote:
> > > >Would calling clearOverlays() on the map remove all of the markers > > > >managed by the GMarkerManager?
> > > map.clearOverlays() removes the current display of the markers from the > > > map, but the data is still in the GMarkerManager's data, so the next > > > time it performs a manager.refresh() it puts them all back.
> > > A manager.refresh() can happen if you call manager.refresh(), when the > > > zoom level changes, when the map pans far enough for a chunk (1024*1024 > > > pixels) previously outside the [visible region plus borderPadding] comes > > > into view.
FYI - We're aware of the need for the additional functions, and actively discussing it. It seems to be one of top requested additions right now by this group.
On Feb 21, 12:03 pm, "Zach Cox" <zcox...@gmail.com> wrote:
> Glad to know I'm not alone. Have there been any clever hacks or > workarounds? I only came up with two: 1) don't use GMarkerManager, > and 2) add all possible markers to the GMarkerManager.
> > You are not alone. Many developers have asked for that and hopefully > > Google will provide it in the future releases of the API.
> > -dkann
> > On Feb 21, 2:29 pm, "Zach Cox" <zcox...@gmail.com> wrote: > > > Seems like GMarkerManager.clearMarkers() would be a useful method to > > > have in the API (for me at least :) ).
> > > On 2/21/07, Mike Williams <nos...@econym.demon.co.uk> wrote:
> > > > >Would calling clearOverlays() on the map remove all of the markers > > > > >managed by the GMarkerManager?
> > > > map.clearOverlays() removes the current display of the markers from the > > > > map, but the data is still in the GMarkerManager's data, so the next > > > > time it performs a manager.refresh() it puts them all back.
> > > > A manager.refresh() can happen if you call manager.refresh(), when the > > > > zoom level changes, when the map pans far enough for a chunk (1024*1024 > > > > pixels) previously outside the [visible region plus borderPadding] comes > > > > into view.
> FYI - We're aware of the need for the additional functions, and > actively discussing it. > It seems to be one of top requested additions right now by this group.
> On Feb 21, 12:03 pm, "Zach Cox" <zcox...@gmail.com> wrote: > > Glad to know I'm not alone. Have there been any clever hacks or > > workarounds? I only came up with two: 1) don't use GMarkerManager, > > and 2) add all possible markers to the GMarkerManager.
> > > You are not alone. Many developers have asked for that and hopefully > > > Google will provide it in the future releases of the API.
> > > -dkann
> > > On Feb 21, 2:29 pm, "Zach Cox" <zcox...@gmail.com> wrote: > > > > Seems like GMarkerManager.clearMarkers() would be a useful method to > > > > have in the API (for me at least :) ).
> > > > On 2/21/07, Mike Williams <nos...@econym.demon.co.uk> wrote:
> > > > > >Would calling clearOverlays() on the map remove all of the markers > > > > > >managed by the GMarkerManager?
> > > > > map.clearOverlays() removes the current display of the markers from the > > > > > map, but the data is still in the GMarkerManager's data, so the next > > > > > time it performs a manager.refresh() it puts them all back.
> > > > > A manager.refresh() can happen if you call manager.refresh(), when the > > > > > zoom level changes, when the map pans far enough for a chunk (1024*1024 > > > > > pixels) previously outside the [visible region plus borderPadding] comes > > > > > into view.
> Thanks Pamela! It's really nice to get feedback like that from the > Google Team - makes us feel loved! :)
> On 2/21/07, pamela (Google Employee) <api.pamela...@google.com> wrote:
> > FYI - We're aware of the need for the additional functions, and > > actively discussing it. > > It seems to be one of top requested additions right now by this group.
> > On Feb 21, 12:03 pm, "Zach Cox" <zcox...@gmail.com> wrote: > > > Glad to know I'm not alone. Have there been any clever hacks or > > > workarounds? I only came up with two: 1) don't use GMarkerManager, > > > and 2) add all possible markers to the GMarkerManager.
> > > On 2/21/07, dkann <dkann...@gmail.com> wrote:
> > > > You are not alone. Many developers have asked for that and hopefully > > > > Google will provide it in the future releases of the API.
> > > > -dkann
> > > > On Feb 21, 2:29 pm, "Zach Cox" <zcox...@gmail.com> wrote: > > > > > Seems like GMarkerManager.clearMarkers() would be a useful method to > > > > > have in the API (for me at least :) ).
> > > > > On 2/21/07, Mike Williams <nos...@econym.demon.co.uk> wrote:
> > > > > > Wasn't it zcox...@gmail.com who wrote:
> > > > > > >Would calling clearOverlays() on the map remove all of the markers > > > > > > >managed by the GMarkerManager?
> > > > > > map.clearOverlays() removes the current display of the markers from the > > > > > > map, but the data is still in the GMarkerManager's data, so the next > > > > > > time it performs a manager.refresh() it puts them all back.
> > > > > > A manager.refresh() can happen if you call manager.refresh(), when the > > > > > > zoom level changes, when the map pans far enough for a chunk (1024*1024 > > > > > > pixels) previously outside the [visible region plus borderPadding] comes > > > > > > into view.
>Glad to know I'm not alone. Have there been any clever hacks or >workarounds? I only came up with two: 1) don't use GMarkerManager, >and 2) add all possible markers to the GMarkerManager.
It's a really horrible hack, but if you're prepared to anchor yourself to a particular API release, then you can kill an existing instance of GMarkerManager by overwriting some of its critical Methods.
In APIv2.74 the two Methods that you need to clobber are manager.refresh() = function() {} manager.Ko() = function () {} marker.Ko() is similar to marker.refresh(), but is called from within the API when the zoom changes or the map pans sufficiently.
If you have two managers, and want to kill one of them, then you can clear the overlays, clobber the managerOne.refresh() and managerOne.Ko(), then use managerTwo.refresh() to bring back the markers of managerTwo that were cleared by clearOverlays.
You can even resurrect a manager that you previously killed by grabbing good copies of those critical Methods from another GMarkerManager, like this:
> >Glad to know I'm not alone. Have there been any clever hacks or > >workarounds? I only came up with two: 1) don't use GMarkerManager, > >and 2) add all possible markers to the GMarkerManager.
> It's a really horrible hack, but if you're prepared to anchor yourself > to a particular API release, then you can kill an existing instance of > GMarkerManager by overwriting some of its critical Methods.
> In APIv2.74 the two Methods that you need to clobber are > manager.refresh() = function() {} > manager.Ko() = function () {} > marker.Ko() is similar to marker.refresh(), but is called from within > the API when the zoom changes or the map pans sufficiently.
> If you have two managers, and want to kill one of them, then you can > clear the overlays, clobber the managerOne.refresh() and > managerOne.Ko(), then use managerTwo.refresh() to bring back the markers > of managerTwo that were cleared by clearOverlays.
> You can even resurrect a manager that you previously killed by grabbing > good copies of those critical Methods from another GMarkerManager, like > this:
I realize this isn't the best method to do this due to memory usage, but until the "clearMarkers()" functionality is made, I've been making due with this:
When I call map.clearOverlays() I also call a method that performs: "mgr = new GMarkerManager(map);"
Like I said, not the best thing to do if you're using hundreds of points, but for my purposes, it suffices. I'm currently making something similar to mapmyrun.com and http://www.usatf.org/routes/map/index.asp? -- my trainer and I want a few different features than those utilized by the aforementioned sites.
Some time ago, I had the same problem. I ended up copying the functionality from the "open" version via prototype into the current version using the proper internal obfuscated variable names.
> I realize this isn't the best method to do this due to memory usage, > but until the "clearMarkers()" functionality is made, I've been making > due with this:
> When I call map.clearOverlays() I also call a method that performs: > "mgr = new GMarkerManager(map);"
> Like I said, not the best thing to do if you're using hundreds of > points, but for my purposes, it suffices. I'm currently making > something similar to mapmyrun.com andhttp://www.usatf.org/routes/map/index.asp? > -- my trainer and I want a few different features than those utilized > by the aforementioned sites.