GeoNode/geonode

Annotations added to a map are not saved

Closed this issue · 5 comments

Expected Behavior

Annotations added to a map should be viewable from on the map area when a user;

  • navigates back to the map at any time
  • refreshes the map page after saving the added annotations

Actual Behavior

Annotations are not viewable after creation + saving.

Steps to Reproduce the Problem

  1. Create an annotation
  2. Make any necessary edits and styling
  3. Click on save
  4. Refresh the page
  5. Navigate to the homepage and back again to the subject map
  6. Confirm that the added annotations are viewable

Specifications

  • GeoNode version: 3.3x
  • Installation method (manual, GeoNode Docker, SPCGeoNode Docker):
  • Platform: Web
  • Additional details:
    DRIVE LINK VIDEO

@giohappy, Annotations are saved correctly with mapstore but they are not added to maplayers on displaying the map. here. since they are not in viewerobj_layers(maplayers).

I think we need to add a check if layer has name Annotations, then we add it to map_layers

@marthamareal no, Annotations are something internal to MapStore client model, GeoNode doesn't care and shouldn't store them as map layers. This is the change we did months ago.

The expected behaviour is:

  • when we save the map, annotations are sent inside th map config and stored transparently inside the resource's blob field
  • when the map is loaded annotations are sent back as part of the mpa config and the client rendered them

GeoNode completely ignores this information. If it isn't working either the client is broken or the backend (erroneously!) is stripping this information.

Yes @giohappy, its the client that strips them off with the conditions in this block.

when I say client I mean MapStore, while you also include the backend :)
Anyway, probably this fix is enough:

diff --git a/mapstore2_adapter/plugins/geonode.py b/mapstore2_adapter/plugins/geonode.py
index a97d8d9f..83fa2d5e 100644
--- a/mapstore2_adapter/plugins/geonode.py
+++ b/mapstore2_adapter/plugins/geonode.py
@@ -155,7 +155,7 @@ class GeoNodeMapStore2ConfigConverter(BaseMapStore2ConfigConverter):
                         layer_ = viewerobj_layers.get(layer['name'])
                         if layer_:
                             layer['featureInfo'] = self.get_layer_featureinfotemplate(layer_)
-                            map_layers.append(layer)
+                        map_layers.append(layer)
                 # the dynamic layer has already been processed by GeoNode upstream views
                 # but we can't tell if it was the one from GET params or not, so we parse it again
                 layer_name = request.GET.get('layer_name')