Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 高亮显示(着色)区域取决于使用mapbog gl js的Mapbox上的土地面积大小_Angular_Mapbox_Mapbox Gl Js - Fatal编程技术网

Angular 高亮显示(着色)区域取决于使用mapbog gl js的Mapbox上的土地面积大小

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': {

我使用的是Angular 11映射框库。 我的问题是如何根据面积大小给国家地区着色。 例如,如果面积大小为0-20英亩-#E8474B,则为21-50英亩-#26B0F9。 我可以使用mapboxAPI获取边界框坐标,但存在访问问题

下面是geojson对象

  {
        '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
    ],
}
//...