<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>镂空面绘制</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<style>
body,
html,
#container {
overflow: hidden;
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script src="//api.map.baidu.com/api?v=1.0&type=webgl&ak=<输入你自己的ak去>"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
<script>
var map = new BMapGL.Map('container', {
enableDblclickZoom: false,
displayOptions: {
building: false
}
});
map.centerAndZoom(new BMapGL.Point(114.140932,22.58307), 18);
map.enableScrollWheelZoom(true);
const aaa = new BMapGL.Point(114.140932,22.58307)
arr = [
new BMapGL.Point(114.140932,22.58307),
new BMapGL.Point(114.141516,22.583045),
new BMapGL.Point(114.142028,22.583007),
new BMapGL.Point(114.141619,22.58153)
]
var bd = new BMapGL.Boundary();
// console.log('外轮廓:', rs.boundaries[0]);
// console.log('内镂空:', rs.boundaries[1]);
var hole = new BMapGL.Polygon(arr, {
fillColor: 'blue',
fillOpacity: 0.2,
strokeOpacity: 0,
strokeWeight: 0
});
map.addOverlay(hole);
</script>
百度地图+镂空面绘制
最新推荐文章于 2024-04-18 09:43:47 发布