我正在尝试使用一个磁贴和多个磁贴向Google Maps JavaScript API添加WMS服务。我目前的代码是:
states = new google.maps.ImageMapType({
getTileUrl: function (coord, zoom) {
// Compose URL for overlay tile
var s = Math.pow(2, zoom);
var twidth = 256;
var theight = 256;
var gBl = map.getProjection().fromPointToLatLng(new google.maps.Point(coord.x * twidth / s, (coord.y + 1) * theight / s));
var gTr = map.getProjection().fromPointToLatLng(new google.maps.Point((coord.x + 1) * twidth / s, coord.y * theight / s));
var bottom_x = parseFloat(gBl.lng()) * 20037508.34 / 180;
var bottom_y = Math.log(Math.tan((90 + parseFloat(gBl.lat())) * Math.PI / 360)) / (Math.PI / 180);
bottom_y = bottom_y * 20037508.34 / 180;
var top_x = parseFloat(gTr.lng()) * 20037508.34 / 180;
var top_y = Math.log(Math.tan((90 + parseFloat(gTr.lat())) * Math.PI / 360)) / (Math.PI / 180);
top_y = top_y * 20037508.34 / 180;
var bbox = bottom_x + "," + bottom_y + "," + top_x + "," + top_y;
var url = "https://demo.boundlessgeo.com/geoserver/topp/wms?";
url += "&service=WMS"; //WMS service
url += "&version=1.1.1"; //WMS version
url += "&request=GetMap"; //WMS operation
url += "&layers=topp:states"; //WMS layers to draw
url += "&styles="; //use default style
url += "&format=image/png"; //image format
url += "&TRANSPARENT=TRUE"; //only draw areas where we have data
url += "&srs=EPSG:3857"; //projection WGS84
url += "&bbox=" + bbox; //set bounding box for tile
url += "&width=256"; //tile size used by google
url += "&height=256";
return url; //return WMS URL for the tile
},
tileSize: new google.maps.Size(256, 256),
opacity: 0.85,
isPng: true
});
有谁知道如何提出要求一个瓷砖与多个瓷砖的请求?