首页 / 浏览问题 / 三维GIS / 问题详情
可以加载一张图片,多个图片就不行了
22EXP 2023年05月08日
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]),

                          ],

                        },

                      },

                    ],

                  },

                  cluster: true,

                    clusterMaxZoom: 12,

                    clusterRadius: 80,

                },

                filter: ["has", "point_count"],

                layout: {

                  "icon-image": aa,

                  "icon-size": 0.1,

                  "icon-allow-overlap": true,

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

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

                  "text-size": 12,

                  "text-anchor": "top",

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

                },

                paint: {

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

                  "text-halo-width": 2,

                },

              });

            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]),

                          ],

                        },

                      },

                    ],

                  },

                  cluster: true,

                  clusterMaxZoom: 12,

                  clusterRadius: 80,

                },

                filter: ["!", ["has", "point_count"]],

                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": false,

                },

                paint: {

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

                  "text-halo-width": 2,

                },

            });

          });

加载不同的图片加载不起来,不报错,只有警告

Image "165541605969350246489" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.
...