Show/hide tile overlays

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Show/hide tile overlays

Jordan Anderson
Hi all,

I'm putting some custom tile overlays on a map via:

var bound_overlay = new CM.Tiles.Base({
    tileUrlTemplate:
'<a href="http://#">http://#{subdomain}.ridethecity.com/tiles/bikes/#{zoom}/#{x}/#{y}.png',
    title: 'Boundaries',
    subdomains: ['tiles'],
    copyright: 'Data',
    opacity: 0.7
});

map.addOverlay(bound_overlay);

I would like to be able to allow users to toggle the overlay on and
off, but at the moment it works like this:
1. The tiles are visible and a user clicks a button to hide the tile
overlay, calling map.removeOverlay.
2. The overlay tiles remain visible until the user zooms in/out, etc.,
which forces a redraw of the map.
3. The user clicks a button to show the tile overlay, calling map.addOverlay.
4. The overlay tiles remain invisible until a users zooms in/out, etc.

Is there a way to force the map to redraw its tiles in steps #1 and
#3? (Or is there a totally different way to accomplish this rather
than addOverlay/removeOverlay every time?)

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Show/hide tile overlays

Jordan Anderson
Is this list still working? I sent this a few days ago, but I didn't
get my usual digest afterward.

The last post on the archive is on December 3rd...:
http://lists.cloudmade.com/pipermail/dev/

On Tue, Dec 15, 2009 at 7:11 AM, Jordan Anderson <[hidden email]> wrote:

> Hi all,
>
> I'm putting some custom tile overlays on a map via:
>
> var bound_overlay = new CM.Tiles.Base({
>    tileUrlTemplate:
> '<a href="http://#">http://#{subdomain}.ridethecity.com/tiles/bikes/#{zoom}/#{x}/#{y}.png',
>    title: 'Boundaries',
>    subdomains: ['tiles'],
>    copyright: 'Data',
>    opacity: 0.7
> });
>
> map.addOverlay(bound_overlay);
>
> I would like to be able to allow users to toggle the overlay on and
> off, but at the moment it works like this:
> 1. The tiles are visible and a user clicks a button to hide the tile
> overlay, calling map.removeOverlay.
> 2. The overlay tiles remain visible until the user zooms in/out, etc.,
> which forces a redraw of the map.
> 3. The user clicks a button to show the tile overlay, calling map.addOverlay.
> 4. The overlay tiles remain invisible until a users zooms in/out, etc.
>
> Is there a way to force the map to redraw its tiles in steps #1 and
> #3? (Or is there a totally different way to accomplish this rather
> than addOverlay/removeOverlay every time?)
>
> Thanks,
> Jordan
>
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Show/hide tile overlays

Vladimir Agafonkin
Hi Jordan,

The list seems working fine for me. :)
The tile overlay not updating on add/removeOverlay seems like a bug, thanks for reporting!

Currently can force layers redraw with these lines of code:
map._forceRedraw = true;
map.setCenter(map.getCenter(), map.getZoom());

On Fri, Dec 18, 2009 at 9:14 PM, Jordan Anderson <[hidden email]> wrote:
Is this list still working? I sent this a few days ago, but I didn't
get my usual digest afterward.

The last post on the archive is on December 3rd...:
http://lists.cloudmade.com/pipermail/dev/

On Tue, Dec 15, 2009 at 7:11 AM, Jordan Anderson <[hidden email]> wrote:
> Hi all,
>
> I'm putting some custom tile overlays on a map via:
>
> var bound_overlay = new CM.Tiles.Base({
>    tileUrlTemplate:
> 'http://#{subdomain}.<a href="http://ridethecity.com/tiles/bikes/#%7Bzoom%7D/#%7Bx%7D/#%7By%7D.png" target="_blank">ridethecity.com/tiles/bikes/#{zoom}/#{x}/#{y}.png',
>    title: 'Boundaries',
>    subdomains: ['tiles'],
>    copyright: 'Data',
>    opacity: 0.7
> });
>
> map.addOverlay(bound_overlay);
>
> I would like to be able to allow users to toggle the overlay on and
> off, but at the moment it works like this:
> 1. The tiles are visible and a user clicks a button to hide the tile
> overlay, calling map.removeOverlay.
> 2. The overlay tiles remain visible until the user zooms in/out, etc.,
> which forces a redraw of the map.
> 3. The user clicks a button to show the tile overlay, calling map.addOverlay.
> 4. The overlay tiles remain invisible until a users zooms in/out, etc.
>
> Is there a way to force the map to redraw its tiles in steps #1 and
> #3? (Or is there a totally different way to accomplish this rather
> than addOverlay/removeOverlay every time?)
>
> Thanks,
> Jordan
>
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev



--
Vladimir Agafonkin
Front-End Architect, CloudMade
+380 93 745 44 61

_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev