leaftlet 中Polygon的使用属性
繪制一個面
var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
map.fitBounds(polygon.getBounds());
?
繪制環
var latlngs = [ [
// first polygon
[[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
[[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole ],
[ // second polygon
[[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]] ] ];
var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
map.fitBounds(polygon.getBounds());
?
// add a polygon
var polygon = L.polygon(
[ [36, 121], [37, 121], [36.5, 122], [36.5, 122.2] ],
{
color: 'green',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(m);
- color?表示邊框顏色
- fillColor?表示填充顏色
- fillOpacity?表示透明度
總結
以上是生活随笔為你收集整理的leaftlet 中Polygon的使用属性的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ArrayMap 源码解析
- 下一篇: 闲谈人生之序列二