Hi,
I am currently stuck on trying to get wms tiles information for google v3
basemap. What I want to retrieve are,
The bounding box of the tile that is clicked on,
The offset distance in pixel between the bounding box and the pixel that has
been clicked on.
Using the default kamap as base, this has been achieved using the code below
but using google as base map, I seem to be getting strange values. I understand
that google uses EPSG:3857 and have transform as required. Please advice the
proper way of doing this.
Thanks
getTileInformationForPoint : function(point) {
var layer = this.map.baseLayer;
//Get the bounds of the tile that encases point
var lonLat = new OpenLayers.LonLat(point.getLongitude(),
point.getLatitude());
var viewPortPixel = this.map.getViewPortPxFromLonLat(lonLat);
var tileBounds = layer.getTileBounds(viewPortPixel);
var tileOrigin = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
var tileOriginPixel = this.map.getViewPortPxFromLonLat(tileOrigin);
return Ext.create('portal.map.TileInformation', {
width : this.map.tileSize.w,
height : this.map.tileSize.h,
offset : { //Object - The point location within the tile being
queried
x : Math.floor(viewPortPixel.x - tileOriginPixel.x), //Number
- offset in x direction
y : Math.floor(viewPortPixel.y - tileOriginPixel.y) //Number
- offset in y direction
},
tileBounds : Ext.create('portal.util.BBox', {
eastBoundLongitude : tileBounds.right,
westBoundLongitude : tileBounds.left,
northBoundLatitude : tileBounds.top,
southBoundLatitude : tileBounds.bottom
})
});
},
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users