openlayers:实现自定义小窗口显示小地图
要在 OpenLayers 中实现自定义小窗口显示小地图,你可以使用 ol.Overlay 控件来创建小窗口,并在小窗口中添加一个独立的地图。以下是一个示例,包括完整的 HTML、CSS 和 JavaScript 源码:
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 Custom Popup 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>
#main-map {
width: 100%;
height: 600px;
}