最大放大地图不适用于fitBounds

时间:2019-08-03 14:27:57

标签: angular leaflet

我想使用最大的Zomm选项显示带有fitbounds的最大放大地图,但无法正常工作

仅当我在setView中更改zoommax 11的值时,它才起作用 但是fitBouns方法否

 this.idbuilding = 'all';
          if (this.buildings[0].building) {
            this.actualbuilding = this.buildings[0];

            this.initmap(

              '48.8583112',
              '2.345686',
             22
            );


             this.map.fitBounds(
               this.buildings.map(el => {

                 return [el.building.latitude, el.building.longitude];

               })

               );
               console.log();


            if (this.isgest) {
              this.loadBuildingsInMap(this.buildings);
            } else {
              this.loadmap(
                this.buildings[0].building.latitude,
                this.buildings[0].building.longitude,
                {
                  iconactive: true
                },
                {
                  name: this.buildings[0].building.name,
                  address: this.buildings[0].building.address,
                  city: this.buildings[0].building.city,
                  zipcode: this.buildings[0].building.zipcode
                });
            }

            // Zoom ile de france
            this.map.setView(new L.LatLng(48.8583112, 2.345686), 11);

          }
        }
      }

0 个答案:

没有答案