1
我可以將谷歌地圖顯示爲wms柵格,但其錯位。圖像的座標系是正確的,一切似乎是確定的,但柵格不合身。這裏是我的代碼:WMS疊加層在谷歌地圖中錯位API
SLPLayer =
new google.maps.ImageMapType (
{
getTileUrl:
function (coord, zoom) {
var proj = map.getProjection();
var zfactor = Math.pow(2, zoom);
// get Long Lat coordinates
var top = proj.fromPointToLatLng(
new google.maps.Point(coord.x * 256/zfactor, coord.y * 256/zfactor));
var bot = proj.fromPointToLatLng(
new google.maps.Point((coord.x + 1) * 256/zfactor, (coord.y + 1) * 256/zfactor));
//corrections for the slight shift of the SLP (mapserver)
var deltaX = 0.0013;
var deltaY = 0.00058;
//create the Bounding box string
var bbox = (top.lng() + deltaX) + "," +(bot.lat() + deltaY) +","
+(bot.lng() + deltaX) +"," +(top.lat() + deltaY);
//base WMS URL
var url ="http://209.41.76.52:8080/geoserver/Caragua/wms?";
url +="&REQUEST=GetMap"; //WMS operation
url +="&SERVICE=WMS"; //WMS service
url +="&VERSION=1.1.0"; //WMS version
url +="&LAYERS=" + "Caragua:caraguaauto11gcpsp2merged_transparent_mosaic_group1"; //WMS layers
url +="&FORMAT=image/png"; //WMS format
url +="&BGCOLOR=0xFFFFFF" ;
url +="&TRANSPARENT=TRUE" ;
url +="&SRS=EPSG:4326"; //set WGS84 3349 ou 4326
url +="&BBOX="+ bbox; // set bounding box
url +="&WIDTH=256"; //tile size in google
url +="&HEIGHT=256" ;
console.log(url);
return url; // return URL for the tile
}, //getTileURL
tileSize: new google.maps.Size(256, 256),
isPng: true
});
//add WMS layer
map.overlayMapTypes.push(SLPLayer);
KARAIO HEIN,NINGUÉM曼加DE NADA NESSA MERDA DESSE網站..所以HTML電子郵件CSS。我已經完成 –