Man, it would be great if people would post their code solution, and not 
just say thanks:

    _getWmsTileBoundingBox(tileCoordinates, gmap) {
       let tileSize = 256;

        // first convert tile coordinates to pixel coordinates for NW and 
SE corners of tile
       let nwPixelX = tileCoordinates.x * tileSize;
       let nwPixelY = tileCoordinates.y * tileSize;
       let sePixelX = (tileCoordinates.x + 1)  * tileSize - 1;
       let sePixelY = (tileCoordinates.y + 1)  * tileSize - 1;

        // next convert pixel coordinates to world (web mercator) coodinates
       let nwWorldX = nwPixelX / (Math.pow(2, zoom));
       let nwWorldY = nwPixelY / (Math.pow(2, zoom));
       let seWorldX = sePixelX / (Math.pow(2, zoom));
       let seWorldY = sePixelY / (Math.pow(2, zoom));

        let nwWorldPoint = new google.maps.Point(nwWorldX, nwWorldY);
       let seWorldPoint = new google.maps.Point(seWorldX, seWorldY);

        // finally use Google Maps' native method to convert world 
coordinates to Lat/Lng coordinates, and return a bounding box
       let nwLatLng = gmap.getProjection().fromPointToLatLng(nwWorldPoint);
       let seLatLng = gmap.getProjection().fromPointToLatLng(seWorldPoint);
       let bbox = nwLatLng.lng() + ',' + seLatLng.lat() + ',' + 
seLatLng.lng() + ',' + nwLatLng.lat();
       return bbox;
   }




On Monday, December 6, 2010 at 2:40:18 PM UTC-7, spiderplant0 wrote:
>
> Thanks Martin, thats just what I was looking for.

-- 
You received this message because you are subscribed to the Google Groups 
"[deprecated] Google Maps JavaScript API v3. Please use the latest post." group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to