Fix track wrapping at edges of map #1163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
As described in Issue #944
Observation tracks often wrap around the map when they cross the edges of the projection. This happens when the track coordinates cross these boundaries leading OpenLayers to place them on opposite side of the map. Eg if the track coordinates change from -178 to 178 degrees longitude. The solution implemented here is to allow the tracks to extend beyond the -180,180 longitude range so that they are plotted continuously. In the previous example the longitude coordinates would be updated from -178, 178 to -178, -182. Logic to handle this was added to the new CMEMS data importers and filters in the API and Stations DB model that shifted coordinates to within these bounds have been removed.
Why did you take this approach?
Correcting the observations data on ingestion reduces the processing needed by the backend. This is a good time to make this change since we're currently in the process of migrating to CMEMS data for our observations.
Screenshot(s)
Glider tracks with original coordinates:
Glider tracks with reformatted coordinates:
Checks
black .
.