getTileUrl: function(level, row, col) { var url = ''; var lv = this.tileInfo.lodsByLevel[level]; if (lv) { var xmin = (col) * this.tileInfo.width * lv.resolution + this.tileInfo.origin.x; var ymin = this.tileInfo.origin.y - (row + 1) * this.tileInfo.height * lv.resolution; var xmax = (col + 1) * this.tileInfo.width * lv.resolution + this.tileInfo.origin.x; var ymax = this.tileInfo.origin.y - (row) * this.tileInfo.height * lv.resolution; url = this.url + '?SERVICE=WMS&REQUEST=GetMap&TRANSPARENT=true&FORMAT=image/png&VERSION=1.3.0' + '&LAYERS=' + this.layers + '&BBOX=' + xmin + "," + ymin + "," + xmax + "," + ymax + '&CRS=EPSG:' + this.tileInfo.spatialReference.wkid + '&WIDTH=' + this.tileInfo.width + '&HEIGHT=' + this.tileInfo.height +'&STYLES='; } return url; }
var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"});
var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", { layers: "modis,global_mosaic", transparent: true }, { opacity: 0.5, singleTile: true });
I have a WMS server I want to make tiled requests of. It is not WMTS, only WMS. OpenLayers handles this but I cant seem to figure out how to do it in the api.Basically, i cant make level row col type requests, i need to make individual bounding box requests
var wms = new OpenLayers.Layer.WMS("MODIS 2002", "http://MCG-AP-GISAPP01.mcgad.local/lizardtech/iserv/ows", {layers: 'MODIS', exceptions:"application/vnd.ogc.se_xml"}, {tileSize: new OpenLayers.Size(256, 256), buffer: 1}); map.addLayer(wms);
Attached sample should be what you are looking for. However to make it generically usable you need consider basemap coordinate system, cache scheme switch and other WMS specific issues. BasicallygetTileUrl: function(level, row, col) { var url = ''; var lv = this.tileInfo.lodsByLevel[level]; if (lv) { var xmin = (col) * this.tileInfo.width * lv.resolution + this.tileInfo.origin.x; var ymin = this.tileInfo.origin.y - (row + 1) * this.tileInfo.height * lv.resolution; var xmax = (col + 1) * this.tileInfo.width * lv.resolution + this.tileInfo.origin.x; var ymax = this.tileInfo.origin.y - (row) * this.tileInfo.height * lv.resolution; url = this.url + '?SERVICE=WMS&REQUEST=GetMap&TRANSPARENT=true&FORMAT=image/png&VERSION=1.3.0' + '&LAYERS=' + this.layers + '&BBOX=' + xmin + "," + ymin + "," + xmax + "," + ymax + '&CRS=EPSG:' + this.tileInfo.spatialReference.wkid + '&WIDTH=' + this.tileInfo.width + '&HEIGHT=' + this.tileInfo.height +'&STYLES='; } return url; }Full code in attachment.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.