首页 / 浏览问题 / WebGIS / 问题详情
在已加载不同的点上实现聚拢并且根据不同的图层控制加载点的大小
22EXP 2023年04月27日
如何使不同的图片坐标分别实现点聚拢,并且可以根据不同的图层控制图片的大小

 const arr = JSON.parse(sessionStorage.getItem("weatherData"));

        arr.forEach((item, index) => {

          let aa = item.tianqi + index;

          this.map.loadImage(item.info, (error, image) => {

            if (error) throw error;

            this.map.addImage(aa, image);

            this.map.addLayer({

              id: aa + "点",

              type: "symbol",

              source: {

                type: "geojson",

                data: {

                  type: "FeatureCollection",

                  features: [

                    {

                      type: "Feature",

                      properties: {

                        title: item.cityName,

                      },

                      geometry: {

                        type: "Point",

                        coordinates: [

                          Number(item.zx.split(",")[0]),

                          Number(item.zx.split(",")[1]),

                        ],

                      },

                    },

                  ],

                },

              },

              layout: {

                "icon-image": aa,

                "icon-size": 0.1,

                "text-field": "{title}",

                "text-font": ["Noto Sans Regular"],

                "text-size": 12,

                "text-anchor": "top",

                "text-offset": [0, 1.25],

                "icon-allow-overlap": true

              },

              paint: {

                'text-halo-color': '#fff',

                'text-halo-width': 2

              }

            });

          });

        });

这是我实现加载不同坐标点的方法,让相同图片实现点聚拢并没有实现

2 个回答

您好,请问您使用的是什么产品?二维还是三维,具体是哪个框架呢?
852EXP 2023年04月28日
二维,mapboxgl

您好,点聚合的实现通过将数据放到geojson里,addlayer时配置即可,可以参考:

https://iclient.supermap.io/examples/mapboxgl/editor.html#markerCluster_3857

https://www.bilibili.com/read/cv22140291/

没有理解您说的让相同图片实现聚拢是什么意思呢,您具体说清楚一些呢。

9,653EXP 2023年04月28日
就是图片聚拢时合并图片,和官网上展示的一模一样
您私信下我电话号码叭,我给您电话沟通了解下您的意思。
18790819197

您好,刚刚和您电话了解了您数据服务和前端组件用的都不是我们的iserver或者iClient for mapbox,

我们这边只能在我们产品的产品接口内为您支持,您使用前端开发插件产品还需要从您使用的产品官方获取支持,

希望可以帮助理解。smiley

...