[Lizmap] Adding external WMS/WMTS to lizMap.map object
igor.buczak at envirosolutions.pl
igor.buczak at envirosolutions.pl
Fri Mar 26 05:10:02 PDT 2021
Hi,
I'm using LizMap in versions 3.4.0 to 3.4.2 and I would like to add a
WMS/WMTS baselayer using JavaScript.
The problem is when I set projection for the layer other than
lizMap.map.projection ('EPSG:3857') - I can't see requested WMS/WMTS
image, because map object send request using coordinates from map
projection.
For example, adding WMS baselayer:
_wmsLayer = new OpenLayers.Layer.WMS("testWMS",_
_ "http://vmap0.tiles.osgeo.org/wms/vmap0", {_
_ layers: 'basic'_
_ }, {_
_ isBaseLayer: true_
_ , projection : new OpenLayers.Projection('EPSG:4269')_
_ , gutter: 5_
_ , buffer : 0_
_ , singleTile : true_
_ , ratio : 1_
_ });_
_lizMap.map.addLayer(wmsLayer);_
_lizMap.baselayers.push(wmsLayer)_
_var newOption = $(`<option value="testWMS">testWMS</option>`)_
_$('#switcher-baselayer-select').append(newOption);_
_var blName = lizMap.map.getLayersByName('testWMS')[0];_
_lizMap.map.setBaseLayer(blName);_
When added baselayer is active, map request for the image:
_http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4269&BBOX=2012355.2261495434,6338336.899867127,2323301.0571703566,6627268.866744874&WIDTH=1004&HEIGHT=943
[1]_
But it won't work, because requested BBOX
(_2012355.2261495434,6338336.899867127,2323301.0571703566,6627268.866744874_)
is wrong, it should be (18.0772944,49.3726875,20.87056861,51.03376694):
http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4269&BBOX=18.0772944,49.3726875,20.87056861,51.03376694&WIDTH=1004&HEIGHT=943
Is there any way to add WMS/WMTS served in a different coordinate
system?
Thanks in advance for any help,
Igor
Links:
------
[1]
http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4269&BBOX=2167809.179245145,6482785.2942039985,2167846.6513039283,6482820.48957395&WIDTH=1004&HEIGHT=943
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/lizmap/attachments/20210326/ac5e8fbe/attachment.html>
More information about the Lizmap
mailing list