所以我一直在Leaflet中使用Choropleth Map,这非常方便,因为我只想要我们项目的特定区域。但是我一直在想,可能会限制用户在我放置Choropleth的区域放置标记吗?
这是GeoJson中的代码
var barangayData = {"type":"FeatureCollection",
"features":[{
"type":"Feature",
"id":"1","properties":{"name":"Bigaa","density":1082 },
"geometry":{
"type":"Polygon",
//lat lng
"coordinates":[[[121.130276,14.298486],
[121.127443,14.295825],
[121.123066,14.293745],
[121.122637,14.291208],
[121.122508,14.288672],
[121.125383,14.281685],
[121.128645,14.285968],
[121.12868645,14.291375],
[121.131821,14.296781]]]}},
{
"type":"Feature",
"id":"2","properties":{"name":"Butong","density":102 },
"geometry":{
"type":"Polygon",
"coordinates":[[[121.146369,14.285885],
[121.140447,14.282683],
[121.140747,14.279647],
[121.140146,14.279397],
[121.139545,14.2787274],
[121.127915,14.275987],
[121.125383,14.281685],
[121.128645,14.285968],
[121.12868645,14.291375],
[121.131821,14.296781]]]}},
{
"type":"Feature",
"id":"3","properties":{"name":"Marinig","density":502 },
"geometry":{
"type":"Polygon",
"coordinates":[[[121.172934,14.267128],
[121.165509,14.265756],
[121.156325,14.262719],
[121.156368,14.260765],
[121.153922,14.259558],
[121.139803,14.257188],
[121.136456,14.255482],
[121.127915,14.275987],
[121.139545,14.2787274],
[121.140146,14.279397],
[121.140747,14.279647],
[121.140447,14.282683],
[121.146369,14.285885]]]}}
]};
这里是image,以提供更清晰的解释