谷歌地图绘制区域

data是经纬度数组
 
let moop = []
for (let i in data) {
let p = data[i]
let lng = parseFloat(p.lng)
let lat = parseFloat(p.lat)
if (!(isNaN(lng) || isNaN(lat))) {
moop.push(new google.maps.LatLng(lat, lng))
}
}
let areas = new google.maps.Polygon({
path: moop,
clickable: false,
fillColor: color,
fillOpacity: 0.5,
strokeWeight: 0
})
areas.setMap(map)
posted @ 2019-07-09 17:22  星陨的菲  阅读(519)  评论(0编辑  收藏  举报