Page MenuHomePhabricator

Editing maps with external data is possible through detour
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Open a wikipage containing a map with external data in Visual Editor.
  • Fokus the map and select inserting a new map from the menu.

What happens?:
Instead of adding a new map, the existing map with the external data is opened in the maps popup.

What should have happened instead?:
Not sure, because it might actually be a nice feature to at least being able to use parts of the VE features to edit the map (e.g. alignment, zoom, etc.). Maybe we could allow this also officially in editing mode and deactivate the parts that can not be used (e.g. the geojson containing the external data).

Other information (browser name/version, screenshots, etc.):
Currently the maps containing external are not supported because there is no preview of those in VE.

Event Timeline

Change 855584 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] [POC] Backup/restore ExternalData while editing map features

https://gerrit.wikimedia.org/r/855584

I played a bit with this "hidden feature". Findings:

  • The pretty much only things that don't work are:
    1. The map in the upper half of the dialog doesn't preview ExternalData layers.
    2. The moment I use editor on the "map contents" tag to add a point or shape all ExternalData disappear.
  • Note that ExternalData are not standard GeoJSON but a custom WMF extension.
  • The editor is an external component we use as-is: Leaflet Draw.
    • The way it works is that we feed Leaflet Draw with our GeoJSON, Leaflet Draw turns it into a FeatureLayer, and whenever an edit is made to that FeatureLayer we ask Leaflet Draw to give us the GeoJSON back. That's why we see the JSON being reformatted every time, causing dirty-diffs.
    • That interactive FeatureLayer can only be a single, flat layer. Any complex GeoJSON (e.g. nested FeatureCollections, or simply an array of FeatureCollections) is flattened in the process. This actually causes dirty-diffs, but usually no data-loss.
    • It appears like Leaflet simply ignores non-standard feature types. That's why we don't get our ExternalData features back, even if they have been added to the FeatureLayer before.

This data-loss is the simple reason we currently block the editor from being used on maps with ExternalData.

Possible ways forward:

  • Disable the backdoor described in this ticket.
  • Just disable the interactive Leaflet Draw map, but leave all other editor features intact.
  • Backup and restore ExternalData features so they survive. POC patch: https://gerrit.wikimedia.org/r/855584
  • Actually pull the ExternalData and visualize it.

Change 855584 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/Kartographer@master] [POC] Backup/restore ExternalData while editing map features

Reason:

https://gerrit.wikimedia.org/r/855584