On 10/25/2011 7:00 AM, Doru wrote:
I'm trying to implement kind of magnifying glass tool for an OL map with
javascript.
For this i have to know the ID of each " " tile element from the layer's
"<div>" element under the current mouse position. Any ideas out there?

I would iterate over the layer's "grid" property to find the tile that fits your mouse click. It would go something like this:

// given some click event, get the pixel
// http://openlayers.org/dev/examples/click.html
var pixel = event.xy;

var magnifyMe = null;
for (tilerow in layer.grid) {
   for (tilei in layer.grid[tilerow]) {
      var tile     = layer.grid[tilerow][tilei];
      if (tile.bounds.containsPixel(pixel)) { magnifyMe = tile; break; }
   }
}

// now magnifyMe is a tile object (or else is null)
// see these docs for how to fetch its URL, e.g. imgDiv property

http://dev.openlayers.org/docs/files/OpenLayers/Tile-js.html
http://dev.openlayers.org/docs/files/OpenLayers/Tile/Image-js.html

--
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: [email protected]
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to