我發現單張庫解決方案
這裏是示例代碼
// a GeoJSON multipolygon
var mp = {
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[101.2, 1.2], [101.8, 1.2], [101.8, 1.8], [101.2, 1.8], [101.2, 1.2]
],
[
[101.2, 1.2], [101.3, 1.2], [101.3, 1.3], [101.2, 1.3], [101.2, 1.2]
],
[
[101.6, 1.4], [101.7, 1.4], [101.7, 1.5], [101.6, 1.5], [101.6, 1.4]
],
[
[101.5, 1.6], [101.6, 1.6], [101.6, 1.7], [101.5, 1.7], [101.5, 1.6]
]
],
[
[
[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]
],
[
[100.35, 0.35], [100.65, 0.35], [100.65, 0.65], [100.35, 0.65], [100.35, 0.35]
]
]
]
},
"properties": {
"name": "MultiPolygon",
"style": {
color: "black",
opacity: 1,
fillColor: "white",
fillOpacity: 1
}
}
};
// create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map', {
center: [0.8, 100.9],
zoom: 8
});
new L.GeoJSON(mp, {
style: function(feature) {
return feature.properties.style
}
}).addTo(map);
和HTML
<div id="map" style="height:480px; width:360px;"></div>
不要忘記裝載傳單要求文件