AW: [OpenLayers-Users] Get the Tile under mouse cursor?
Arnd Wippermann
arnd.wippermann at web.de
Tue Oct 25 12:25:30 EDT 2011
Hi,
that' the way I do it:
function getSLDfromGrid(evt, lyr)
{
var ctr = map.getLonLatFromPixel(evt.xy);
var flag=false;
for(var i=0;i<lyr.grid.length;i++)
{
for(var k=0;k<lyr.grid[i].length;k++)
{
bounds = lyr.grid[i][k].bounds;
if(bounds.containsLonLat(ctr, false))
{ flag=true;
break;
}
}
if(flag)
break;
}
if(i>=lyr.grid.length) i=0
if(k>=lyr.grid[i].length) k=0
var params = OpenLayers.Util.getParameters(lyr.grid[i][k].url);
params["SLD"] = lyr.grid[i][k].SLD;
lyr.mergeNewParams({SLD : params["SLD"]});
lyr.vendor.SLD = params["SLD"];
themeApplied = true;
}
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL210/WMS_Tiles_Access/WMS_Tiles_
Access.asp
Arnd
-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Doru
Gesendet: Dienstag, 25. Oktober 2011 16:00
An: users at openlayers.org
Betreff: [OpenLayers-Users] Get the Tile under mouse cursor?
Hi all,
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?
p.s.: seems to be something similar described here
http://lists.osgeo.org/pipermail/openlayers-users/2010-May/017652.html
but the attached URL is broken:
http://acuriousanimal.orggeo.net/?q=content/openlayers-how-compute-tile-name
-under-mouse
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Get-the-Tile-under-mouse-cursor-tp692
8900p6928900.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
More information about the Users
mailing list