赞
踩
参考:https://blog.csdn.net/zxl761303248/article/details/110520310
将以上预览地图地址解码:
http://192.168.37.85:9090/geoserver/zxl/wms?
service=WMS&version=1.1.0
&request=GetMap
&layers=zxl:zxl_tif_6
&bbox=-1078.0454581182594,-954.7562752129634,6180.5753625258385,6081.378083495683
&width=768
&height=744
&srs=EPSG:3857
&styles=
&format=application/openlayers
由此可得:
WMS服务URL | 图层名称 | 地理坐标系code | minX | minY | maxX | maxY |
---|---|---|---|---|---|---|
http://192.168.37.85:9090/geoserver/zxl/wms | zxl:zxl_tif_6 | EPSG:3857 | -1078.0454581182594 | -954.7562752129634 | 6180.5753625258385 | 6081.378083495683 |
import Map from 'ol/Map'; import View from 'ol/View'; import TileLayer from 'ol/layer/Tile'; import TileWMS from 'ol/source/TileWMS'; import Projection from 'ol/proj/Projection'; this.map = new Map({ target: 'map', layers: [ new TileLayer({ source: new TileWMS({ url: 'http://192.168.37.85:9090/geoserver/zxl/wms', params: { "LAYERS": 'zxl:zxl_tif_6' } }) }) ], view: new View({ projection: new Projection({ code: 'EPSG:3857', units: 'm' }) }) }); this.map.getView().fit([-1078.0454581182594, -954.7562752129634, 6180.5753625258385, 6081.378083495683], this.map.getSize());
当前代码基于angular框架开发,可参考:https://blog.csdn.net/zxl761303248/article/details/110467758
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。