Skip to content

Load external data on Geoman with correct type #899

Discussion options

You must be logged in to vote

This is because Rectangle is not existing in GeoJSON definition. You need to check if the feature is a Rectangle and then create a new shape.
I see that you have the shape property, so you can check on this if it is a Rectangle:

properties: {
shape: 'Rectangle',
},


  var removeList = [];
  var addList = [];
  // function to check if it is a Rectangle
  var onEachFeature = (feature, layer) => {
      if (feature.properties.shape === 'Rectangle') {
        console.log("Rectanlge");
        // we need to create a new Rectangle Layer and add it to an array
        addList.push(L.rectangle(layer.getBounds()));
        // we add the current layer to the remove list
        removeList.push(la…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@binarybaba
Comment options

Answer selected by Falke-Design
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
3 participants
Converted from issue

This discussion was converted from issue #898 on May 13, 2021 18:46.