首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在传单地图上添加哨兵层

在传单地图上添加哨兵层
EN

Stack Overflow用户
提问于 2020-05-13 20:02:11
回答 1查看 498关注 0票数 0

这就是我如何为sentinel: Sentinel2定义获取wms映像的url:

"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}方面有问题

在这个图像中,我看到请求是成功的。

但是,当我处理请求URL时,我会看到以下消息:

代码语言:javascript
复制
<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参数。

我读过bbox

地图范围的边框。值为minx,miny,maxx,maxy,单位为SRS。

这也是工作请求url:

代码语言:javascript
复制
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参数这么长numbers:BBOX=2861802.338996999%2C5390950.730896911%2C2866694.30880725%2C5395842.700707162

您能帮我在bbox参数中添加些什么,以便获得正确的参数并查看图层.

EN

回答 1

Stack Overflow用户

发布于 2020-05-13 22:00:39

解决方案:

Javascript

代码语言:javascript
复制
// 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:

代码语言:javascript
复制
<style>
    #map {
        height: 500px;
    }
</style>

HTML元素:

代码语言:javascript
复制
<div id="map"></div>

参见这里的WMS示例:小提琴手例子

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61783789

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档