Skip to content

Example of collection of all layers and GeoJSON generation from Geoman #1527

Discussion options

You must be logged in to vote

Sorry i think found solution:
#1342

function toGeoJSON() {
      var allLayers = new L.featureGroup();
      map_editor.eachLayer(function (layer) {
        if (layer instanceof L.Path) {
          allLayers.addLayer(layer);
        } else {
          if (layer instanceof L.Marker) {
            allLayers.addLayer(layer);
          }
        }
      });
      var geojson = allLayers.toGeoJSON();
      console.log(geojson);
    }
toGeoJSON();

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by VlasovAlexey
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants