这就是我如何定义我的网址来获取哨兵的wms图像: 哨兵2:
"https://kade.si/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/jpeg&TRANSPARENT=true&LAYERS=Landsat-8&TILED=true&format=image%2Fvnd.jpeg-png&WIDTH=320&HEIGHT=320&CRS=EPSG%3A3857&STYLES=&MAP_RESOLUTION=112.5&BBOX={x}{y}{x}{y}"
,
我在定义如何获取&BBOX={x}{y}{x}{y}{y}时遇到问题
在此图像中,我看到请求成功
[!在此处输入图像描述][1]][1]
但是当我处理请求 URL 时,我看到以下消息:
<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
<ServiceException>
msWMSLoadGetMapParams(): WMS server error. Wrong number of arguments for BBOX.
</ServiceException>
如何设置正确的 Bbox 参数。
我读了那个盒子
地图范围的边界框。值是最小值,分钟,最大x,最大值,以SRS为单位。
这也是工作请求网址:
https://kade.si/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/jpeg&TRANSPARENT=true&LAYERS=Landsat-8&TILED=true&format=image%2Fvnd.jpeg-png&WIDTH=320&HEIGHT=320&CRS=EPSG%3A3857&STYLES=&MAP_RESOLUTION=112.5&BBOX=2861802.338996999%2C5390950.730896911%2C2866694.30880725%2C5395842.700707162
为什么bbox参数这么长:BBOX=2861802.338996999%2C5390950.730896911%2C2866694.30880725%2C5395842.700707162
你能帮我添加什么在 bbox 参数中吗,所以传单以获得正确的参数并查看图层......
解决方案:
爪哇语
// Declare map using EPSG3857 projection (default is also 3857, so just optionnal here) and set center
const center = [38, 20.472157];
const map = L.map('map', {
crs: L.CRS.EPSG3857
}).setView(center, 4);
// Define wmsOptions for wmsLayer
const wmsOptions = {
layers: 'Landsat-8',
transparent: true,
format: 'image/png'
}
// WMS Layer constructor
const wmsLayer = L.tileLayer.wms('https://kade.si/cgi-bin/mapserv', wmsOptions);
// add To the map
wmsLayer.addTo(map);
不要忘记为div 地图设置高度:
样式 CSS :
<style>
#map {
height: 500px;
}
</style>
HTML 元素 :
<div id="map"></div>
在此处查看 WMS 的示例:jsfiddle 示例