openlayers:实现KML矢量地图
以下是一个简单的 OpenLayers 示例,展示如何加载 KML 矢量地图。在这个例子中,我使用了一个包含一些地理标记的 KML 文件。请注意,你需要替换 path/to/your.kml 为你实际的 KML 文件路径。
HTML 文件(index.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenLayers KML Vector Map Example</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v6.13.0/css/ol.css" type="text/css">
<style>
#map {
width: 100%;
height: 600px;
}
</style