Project

General

Profile

Actions

Feature #1531

closed

Map overlay improved

Added by Stefan Eichert over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Maps
Target version:
Start date:
2021-06-16
Estimated time:

Description

Currently map overlays can only be from files that were georeferenced in WGS84 CRS.
By using https://github.com/IvanSanchez/Leaflet.ImageOverlay.Rotated the three corner points of the image can be entered and the image is rotated correctly.

I created the branch feature_map_overlay_improved where I implemented this functionality.
The js library is only loaded using CDN in map.html
@Alexander Watzinger: if you approve the commit and merge it, could you load this js library the way you usually do this (npm?)
The hitherto overlays with only two points should still work. I just could not test it properly as I do not have the images locally.

Actions #1

Updated by Alexander Watzinger over 3 years ago

  • Category set to Maps
  • Status changed from New to Acknowledged
  • Target version set to Wishlist

Thank you for reporting, I try to take a look at it next week in more detail.

Actions #2

Updated by Alexander Watzinger over 3 years ago

  • Status changed from Acknowledged to In Progress
  • Assignee set to Alexander Watzinger
  • Target version changed from Wishlist to 6.4.0
Actions #3

Updated by Alexander Watzinger over 3 years ago

So I looked into it and pushed some changes into the feature branch. There are multiple topics

Import of JavaScript libraries

Since we don't want to depend on loading external scripts I changed it to be loaded the "npm" way. You can try this yourself the next time (the author even noted this in his readme) with editing the openatlas/static/package.json file.
To get the changes, you have to run something like this after pulling the feature branch:

    $ cd openatlas/static
    $ pip3 install -e ./
    $ ~/.local/bin/calmjs npm --install openatlas

I also did some stuff like joining the overlay templates, fixing tests, merging newest develop version and the like.

Former values

Not sure what you mean with you couldn't test because you don't have the files locally. I don't have them either so I just created some. When testing it with images created the old way (so adding them in develop) they still displayed correctly (in the new feature branch) but when trying to edit them there is a script error because you renamed/added variables e.g.

    File "/home/alex/projects/www/openatlas/openatlas/views/overlay.py", line 75, in overlay_update
    form.bottom_left_easting.data = bounding[2][1]
    IndexError: list index out of range

We can't leave it like this. One rather radical solution would be to delete all existing overlay data but you may want to look into this.
Also, even if the form would display somehow, all 6 (new) values seem to be required so it would be problematic with only 4 from the old system.

Manual

Before adding this feature we need an updated manual entry for overlays, see at the bottom of:
https://demo.openatlas.eu/static/manual/tools/map.html#map-overlay. I guess the easiest way would be to post some text here and I get it into the actual manual.

Further steps

Once you solved the incompatible issue with the old values and provided an updated manual text, I can merge this into develop.

Actions #4

Updated by Alexander Watzinger over 3 years ago

  • Assignee changed from Alexander Watzinger to Stefan Eichert
Actions #5

Updated by Alexander Watzinger over 3 years ago

By the way, overlay info is saved in database table web.overlay as text in the bounding_box field.

Actions #6

Updated by Stefan Eichert over 3 years ago

  • Assignee changed from Stefan Eichert to Alexander Watzinger

I implemented an if condition that checks the length of the bounding array if you access the update page. Now, if the length is 2 (as for the old versions) the coordinates are set to zero and can be updated to the new version without any errors.
It is saved the same way as before, only with one additional pair of coordinates.
If the old overlays (with only 2 coordinates) are only displayed, the system also checks the length of the bounding array and displays them correctly.
Also the manual text in the map.rst file is updated.

Actions #7

Updated by Alexander Watzinger over 3 years ago

  • Description updated (diff)
  • Status changed from In Progress to Closed

Thank you for the fixes and especially for updating the manual text directly in the .rst file. I merged it into develop, you can delete feature_image_overlay_improved (I already removed it on GitHub).
I updated the THANADOS instance, please make sure it works there and also the demo-dev version in case you want to test there.
This is a nice new feature, good work!

Actions

Also available in: Atom PDF