贴代码
<div id="map"></div>
<script type="text/javascript">
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
title: "Global Imagery",
source: new ol.source.TileWMS({
url: '*************',//geoserver上地图地址
params: {
LAYERS: '*******', VERSION: '1.1.0'
}// 图层名字
})
})
],
view: new ol.View({
projection: 'EPSG:4326',
center: [0, 0],
zoom: 11,
})
});
</script>