构建OpenLayers,首先在在要web电子海图的网页中引入ol.js和ol.css这两个文件,你可以到openlayers官网去下载这个文件,也可以到,并且可以查看演示的效果。
map的创建完整代码
<!doctype html>
<html lang="en"><head><link rel="stylesheet" href="js/ol/ol.css" type="text/css">< src="js/ol4.6.5.js"></><title>OpenLayers example</title></head>
<style>.map {height: 100%;width: 100%;}</style><body><h2>My Map</h2><div id="map" class="map"></div><script>
var seamap = new ol.layer.Tile({source : new ol.source.XYZ({url : "112.126.96.159/Ship/Map?z={z}&y={y}&x={x}",projection : 'EPSG:3857'})
});zoomslider = l.ZoomSlider(); zoomcontrol = l.Zoom();
map = new ol.Map({layers : [ seamap ],view : new ol.View({center : ansform([ 119.22, 39.222 ], 'EPSG:4326','EPSG:3857'),projection : 'EPSG:3857',zoom : 5,minZoom : 2,maxZoom : 15,}),target : 'map',controls : [ zoomslider, zoomcontrol ]});
</script> </body> </html>
联系作者及参考文章:web电子海图接口 web电子海图 ,电子海图开发引擎
本文发布于:2024-02-02 15:48:25,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170686010444814.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |