Angular 高亮显示(着色)区域取决于使用mapbog gl js的Mapbox上的土地面积大小
我使用的是Angular 11,映射框库。 我的问题是如何根据面积大小给国家地区着色。 例如,如果面积大小为0-20英亩-#E8474B,则为21-50英亩-#26B0F9。 我可以使用mapboxAPI获取边界框坐标,但存在访问问题 下面是geojson对象Angular 高亮显示(着色)区域取决于使用mapbog gl js的Mapbox上的土地面积大小,angular,mapbox,mapbox-gl-js,Angular,Mapbox,Mapbox Gl Js,我使用的是Angular 11,映射框库。 我的问题是如何根据面积大小给国家地区着色。 例如,如果面积大小为0-20英亩-#E8474B,则为21-50英亩-#26B0F9。 我可以使用mapboxAPI获取边界框坐标,但存在访问问题 下面是geojson对象 { 'type': 'geojson', 'data': { 'type': 'Feature', 'geometry': {
{
'type': 'geojson',
'data': {
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
"coordinates":[]
}
}
}
谁能给我建议解决这个问题的正确方法?您可以使用来计算每个特征的面积,然后使用来确定多边形的面积
图层的“绘制”属性应如下所示:
//...
paint: {
'fill-color': [
'case',
['<=', ['get', 'area'], 10],
'red', // use red when area is <= 10
['<=', ['get', 'area'], 20],
'green', // use green when area is <= 20
['<=', ['get', 'area'], 30],
'blue', // use blue when area is <= 30
'grey' // fallback, use grey when none of the above apply
],
}
//...
/。。。
油漆:{
“填充颜色”:[
“案例”,
['
//...
paint: {
'fill-color': [
'case',
['<=', ['get', 'area'], 10],
'red', // use red when area is <= 10
['<=', ['get', 'area'], 20],
'green', // use green when area is <= 20
['<=', ['get', 'area'], 30],
'blue', // use blue when area is <= 30
'grey' // fallback, use grey when none of the above apply
],
}
//...