Problem/Motivation

When a saved map is edited the GeoJSON data string is extended with new data, instead of replaced.

Steps to reproduce

  1. Create a field with the leaflet widget
  2. Add some data by drawing multiple polygons
  3. Check the GeoJSON field (1 feature for each polygon)
  4. Save the node
  5. Edit the saved node
  6. Check the GeoJSON field (1 multiploygon, this conversion is done by geoPHP)
  7. Delete the new combined multipolygon in the leaflet map
  8. Check the GeoJSON field (1 feature with 1 multiploygon)

Proposed resolution

Clear the correct list of layers.

Remaining tasks

Create a patch
Review the patch
Apply the patch

User interface changes

None

API changes

None

Data model changes

None

Issue fork leaflet-3183154

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Tessa Bakker created an issue. See original summary.

tessa bakker’s picture

The MR will always force a recalculation of the string for the GeoJSON-field.

Credits to SpadXIII for finding the problem of this issue.

tessa bakker’s picture

Status: Active » Needs review

  • itamair committed e606378 on 3183154-clear-layers
    Add comment for Issue #3183154: Always clear the layers in drawnItems on...
  • simgroep committed ef6db42 on 3183154-clear-layers
    Issue #3183154: Always clear the layers in drawnItems on map updates
    

itamair made their first commit to this issue’s fork.

itamair credited simgroep.

itamair’s picture

Status: Needs review » Fixed

Thanks so much @Tessa. I couldn't reproduce your issue. I think that last version of Leaflet was already working properly on this.
But your code updates looks better than the existing one. Hence I am merging and committing into dev.
Will be part of the next Leaflet 2.1.x release ...

itamair credited SpadXIII.

itamair’s picture

  • itamair committed e781f8f on 2.1.x authored by Tessa Bakker
    Issue #3183154 by Tessa Bakker, itamair, simgroep, SpadXIII: Drupal....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.