I am trying to see a WMS layer above Google maps API's satellite baselayer.
When building the WMS URL string I am using WIDTH=256 and HEIGHT=256 which I think is the default. The thing is that the tiles are not matching one with another. It can be seen clearly in the following screenshot (notice the tiles):
The layer is being loaded above google maps with this code taken from internet:
function initialize() { … var wmsLayer = WMS_Definition(); wmsLayer.Layername = 'Portales'; map.overlayMapTypes.push(wmsLayer); map_layers.push(wmsLayer); } function WMS_Definition() { var wmsOptions = { alt: "Portales", getTileUrl: WMSGetTileUrl, isPng: true, name: "Portales", tileSize: new google.maps.Size(256, 256) }; return new google.maps.ImageMapType(wmsOptions); } function WMSGetTileUrl(tile, zoom) { var projection = window.map.getProjection(); var zpow = Math.pow(2, zoom); var top = projection.fromPointToLatLng(new google.maps.Point(tile.x * 256 / zpow, (tile.y + 1) * 256 / zpow)); var bot = projection.fromPointToLatLng(new google.maps.Point((tile.x + 1) * 256 / zpow, (tile.y ) * 256 / zpow)); //corrections for the slight shift var bbox = top.lng() + "," + bot.lat() + "," + bot.lng() + "," + top.lat(); var baseURL = "http://eudala2.getxo.eus/qgis/qgis_mapserv.fcgi.exe?map=wms/wms.qgs"; var format = "image%2Fpng"; //type of image returned or image/jpeg var request = "GetMap"; var version = "1.3.0"; var service = "WMS"; var layers = "getxo_portales_estadistica_oficial"; var crs ="EPSG:4326"; //"EPSG:23030"; var width ="256"; var height = "256"; //Add the components of the URL together var url = baseURL ; url+= "&request=" + request; url+= "&Service=" + service; url+= "&version=" + version; url+= "&layers=" + layers; url+= "&format=" + format; url+= "&TRANSPARENT=TRUE"; url+= "&CRS=" + crs; //url += "&SRS=EPSG:4326"; url+= "&Styles="; url+= "&BBOX=" + bbox; url+= "&width=" + width; url+= "&height=" + height; return url; } An example of URL generated by this code:
http://eudala2.getxo.eus/qgis/qgis_...421875,43.32617670160033&width=256&height=256
If I load the WMS layer in QGIS for example and I add the WMS layer with 256 width and 256 height I am getting the result seen in the image above.
On the other hand, if I leave the width and height parameters blank when adding the WMS layer in QGIS I am seeingthe layer perfectly. In my case I need from client to specify a mandatory width and height in URL and boundingbox in each request so I don't really know how to solve this...I don't even know where's the source of the problem.
The layer is being server by QGIS Server in WGS84 SRID. The layer is stored in a postgis database in 23030 SRID and the QGIS project has online projection to WGS84.
I am starting to think that the issue may come from the google map's tile generating code I am using...
أكثر...
When building the WMS URL string I am using WIDTH=256 and HEIGHT=256 which I think is the default. The thing is that the tiles are not matching one with another. It can be seen clearly in the following screenshot (notice the tiles):

The layer is being loaded above google maps with this code taken from internet:
function initialize() { … var wmsLayer = WMS_Definition(); wmsLayer.Layername = 'Portales'; map.overlayMapTypes.push(wmsLayer); map_layers.push(wmsLayer); } function WMS_Definition() { var wmsOptions = { alt: "Portales", getTileUrl: WMSGetTileUrl, isPng: true, name: "Portales", tileSize: new google.maps.Size(256, 256) }; return new google.maps.ImageMapType(wmsOptions); } function WMSGetTileUrl(tile, zoom) { var projection = window.map.getProjection(); var zpow = Math.pow(2, zoom); var top = projection.fromPointToLatLng(new google.maps.Point(tile.x * 256 / zpow, (tile.y + 1) * 256 / zpow)); var bot = projection.fromPointToLatLng(new google.maps.Point((tile.x + 1) * 256 / zpow, (tile.y ) * 256 / zpow)); //corrections for the slight shift var bbox = top.lng() + "," + bot.lat() + "," + bot.lng() + "," + top.lat(); var baseURL = "http://eudala2.getxo.eus/qgis/qgis_mapserv.fcgi.exe?map=wms/wms.qgs"; var format = "image%2Fpng"; //type of image returned or image/jpeg var request = "GetMap"; var version = "1.3.0"; var service = "WMS"; var layers = "getxo_portales_estadistica_oficial"; var crs ="EPSG:4326"; //"EPSG:23030"; var width ="256"; var height = "256"; //Add the components of the URL together var url = baseURL ; url+= "&request=" + request; url+= "&Service=" + service; url+= "&version=" + version; url+= "&layers=" + layers; url+= "&format=" + format; url+= "&TRANSPARENT=TRUE"; url+= "&CRS=" + crs; //url += "&SRS=EPSG:4326"; url+= "&Styles="; url+= "&BBOX=" + bbox; url+= "&width=" + width; url+= "&height=" + height; return url; } An example of URL generated by this code:
http://eudala2.getxo.eus/qgis/qgis_...421875,43.32617670160033&width=256&height=256
If I load the WMS layer in QGIS for example and I add the WMS layer with 256 width and 256 height I am getting the result seen in the image above.
On the other hand, if I leave the width and height parameters blank when adding the WMS layer in QGIS I am seeingthe layer perfectly. In my case I need from client to specify a mandatory width and height in URL and boundingbox in each request so I don't really know how to solve this...I don't even know where's the source of the problem.
The layer is being server by QGIS Server in WGS84 SRID. The layer is stored in a postgis database in 23030 SRID and the QGIS project has online projection to WGS84.
I am starting to think that the issue may come from the google map's tile generating code I am using...
أكثر...