Hi,

I would do this (writing from memory so this code may not work):

var gm = google.maps;
...
var proj = map.getCurrentMapType().getProjection();
var boundsLatLng = map.getBounds();
var bounds = new
gm.Bounds([proj.fromLatLngToPixel(boundsLatLng.getSouthWest(),
mapzoom),proj.fromLatLngToPixel(boundsLatLng.getNorthEast(),
map.getZoom())]);
var tileXY =
[bounds.minX,bounds.minY,bounds.maxX,bounds.maxY].collect(function(c){return
(c/256).floor();});
var tileBounds = new gm.Bounds([new gm.Point(tileXY[0],tileXY[1]),new
gm.Point(tileXY[2],tileXY[3])]);

This should give you a bounding box of the tile coordinates at any point of
the map at any zoom level.

Good luck!

Vasily


2009/5/20 [email protected] <[email protected]>

>
> Hi,
>
> I'm wondering the best way to get a list of all tiles currently in the
> viewport, and also to know which ones have left the viewport on a
> recent change (eg pan)
>
> For example, this shows how given any location you can get the tile
> http://code.google.com/apis/maps/documentation/examples/tile-detector.html
> .. so theoretically you loop over your viewport in 256 pixels chunks,
> and then get a list and compare it to your old list of tiles...
>
> Or I thought maybe you could somehow use a custom overlay and have
> your tilelayer.getTileUrl method return new items for comparison.. but
> then I still don't know which tiles have recently left the view.
>
> I assume (maybe wrong) that the tile layers keep track of what tiles
> to potentially recycle ... but I'm not sure the best way to access
> that info.
>
> Thanks,
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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