leaflet display superimposed load geojson

geojson need to make shp, and then import the following Web site to generate geojson.

https://mapshaper.org/

GeoJSON, preferably put back, by the reception JSON asynchronous request to load, and then displayed.

 

getGeojsonByName({name:geojson_name}).then(data=>{
          if (this.bondarylayer) {
            if (this.map.hasLayer(this.bondarylayer))
            {
              this.map.removeLayer(this.bondarylayer);
            }
          }
          this.bondarylayer = L.geoJSON(data, {
            style: {
              color: '#E066FF',
              fillOpacity: 0,
              weight: 4,
            },
            pane: 'overlayPane'
          });
          this.map.addLayer(this.bondarylayer);
        });

     After overlay maps,

this.map.flyTo ([34.22, 109.114], 9, {animate: true, duration: 0.2}); 

The field of view is added to the map of the corresponding region.

Guess you like

Origin www.cnblogs.com/tiandi/p/12321413.html