WMS BBOX 参数不显示框而是整个世界
WMS BBOX parameter not showing the box but whole world
我正在尝试调用 WMS 服务,但 BBOX 参数似乎不起作用。问题是没有考虑 BBOX 值,仍然显示了整个世界。我的代码如下
map = new ol.Map({ target: 'map', layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),name:'Map'
}),
new ol.layer.Image({
name:'Fires',
source: new ol.source.ImageWMS({
url: 'https://firms.modaps.eosdis.nasa.gov/wms',
params: {'LAYERS': 'fires_viirs_24','MAP_KEY':'c25ad450306982d960f6dac44bc80059',
'COLORS':'127+9+9','SIZE':'10','SYMBOLS':'triangle',
'SRS':'EPSG:3857','WIDTH':'1024','BBOX':'18.808594,34.615127,29.047852,41.902277'}
})
}) ], view: new ol.View({
center: ol.proj.fromLonLat([23.8567, 38.5204]),
zoom: 6 }) });
下面是codepen
一些参数是动态设置的,您设置的任何值都将被覆盖。 OpenLayers 设置 BBOX 以匹配视口。参见 https://openlayers.org/en/v4.6.5/apidoc/ol.source.ImageWMS.html
WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set
dynamically.
您可以使用图层的范围选项限制范围:
new ol.layer.Image({
name:'Fires',
source: new ol.source.ImageWMS({
url: 'https://firms.modaps.eosdis.nasa.gov/wms',
params: {'LAYERS': 'fires_viirs_24','MAP_KEY':'c25ad450306982d960f6dac44bc80059',
'COLORS':'127+9+9','SIZE':'10','SYMBOLS':'triangle', VERSION: '1.1.0'
},
projection:'EPSG:3857',
}),
extent: ol.proj.transformExtent([18.808594,34.615127,29.047852,41.902277],'EPSG:4326','EPSG:3857'),
})
我正在尝试调用 WMS 服务,但 BBOX 参数似乎不起作用。问题是没有考虑 BBOX 值,仍然显示了整个世界。我的代码如下
map = new ol.Map({ target: 'map', layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),name:'Map'
}),
new ol.layer.Image({
name:'Fires',
source: new ol.source.ImageWMS({
url: 'https://firms.modaps.eosdis.nasa.gov/wms',
params: {'LAYERS': 'fires_viirs_24','MAP_KEY':'c25ad450306982d960f6dac44bc80059',
'COLORS':'127+9+9','SIZE':'10','SYMBOLS':'triangle',
'SRS':'EPSG:3857','WIDTH':'1024','BBOX':'18.808594,34.615127,29.047852,41.902277'}
})
}) ], view: new ol.View({
center: ol.proj.fromLonLat([23.8567, 38.5204]),
zoom: 6 }) });
下面是codepen
一些参数是动态设置的,您设置的任何值都将被覆盖。 OpenLayers 设置 BBOX 以匹配视口。参见 https://openlayers.org/en/v4.6.5/apidoc/ol.source.ImageWMS.html
WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically.
您可以使用图层的范围选项限制范围:
new ol.layer.Image({
name:'Fires',
source: new ol.source.ImageWMS({
url: 'https://firms.modaps.eosdis.nasa.gov/wms',
params: {'LAYERS': 'fires_viirs_24','MAP_KEY':'c25ad450306982d960f6dac44bc80059',
'COLORS':'127+9+9','SIZE':'10','SYMBOLS':'triangle', VERSION: '1.1.0'
},
projection:'EPSG:3857',
}),
extent: ol.proj.transformExtent([18.808594,34.615127,29.047852,41.902277],'EPSG:4326','EPSG:3857'),
})