openlayers:实现加载海图
加载海图的方式与加载普通瓦片地图稍有不同,通常需要使用专门的海图服务或者海图数据集。以下是一个示例代码,演示了如何加载海图数据:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenLayers Sea Map</title>
<!-- 引入 OpenLayers 库 -->
<link rel="stylesheet" href="https://openlayers.org/en/latest/css/ol.css" type="text/css">
<script src="https://openlayers.org/en/latest/build/ol.js"></script>
<style>
#map {
width: 100%;
height: 500px;
}
</style>
</head>