Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable drawing arbitrary polygons on the Cesium map #2180

Closed
robyngit opened this issue Aug 15, 2023 · 1 comment · Fixed by #2204
Closed

Enable drawing arbitrary polygons on the Cesium map #2180

robyngit opened this issue Aug 15, 2023 · 1 comment · Fixed by #2204
Assignees
Labels
ADC CI-13 Dynamic data visualizations in portals (ADC deliverable) arctic data center cesium enhancement pdg Permafrost Discovery Gateway
Milestone

Comments

@robyngit
Copy link
Member

As a first step in #1889 and potentially to support #1776, we need a tool for drawing polygons on the surface of the Earth in Cesium. The coordinates for the polygon should be accessible to other tools, like the plot viewer and data downloading mechanism. There should be some sort of UI for turning on/off drawing mode, editing and removing the polygon. There should be a mapConfig option to hide all of this UI. We will probably want to keep it hidden until there's some purpose to drawing on the map (i.e. until we can pass the polygon onto a plot viewer or data downloader)

@robyngit robyngit added this to the 2.27.0 milestone Aug 15, 2023
@robyngit robyngit added the pdg Permafrost Discovery Gateway label Aug 16, 2023
robyngit added a commit that referenced this issue Aug 23, 2023
- Create the initial DrawTool view and layout methods

Issue #2180
robyngit added a commit that referenced this issue Aug 24, 2023
- Add listeners for when layers are added or removed from the MapAsset
  collection and update the layers rendered on the Cesium map and the layers
  displayed in the layer list.

Issue #2180, #1923, #1775
robyngit added a commit that referenced this issue Aug 24, 2023
- Still a WIP
- Make draw tool work directly with Map model, independent of widget
- Rename DrawTool to DrawToolView

Issue #2180
robyngit added a commit that referenced this issue Aug 31, 2023
- Add MapInteraction, GeoPoint and GeoBoundingBox models
- Make the CesiumWidgetView methods smaller and more modular
- Move Map model attributes to the MapInteraction model (selectedFeatures, currentPosition, currentScale, and currentViewExtent)
- In MapAsset models, listen for changes to cesiumOptions and update Cesium model
- In map connectors, don't use new models as defaults to avoid instantiating new models unnecessarily
- Pass GeoPoint and GeoScale models directly to the ScaleBarView

Issues #2189, #2180, #2187
robyngit added a commit that referenced this issue Sep 20, 2023
- Still needs methods to clear the polygon and stop drawing; proper UI; testing

Issue #2180
robyngit added a commit that referenced this issue Sep 21, 2023
- Add the GeoPoints collection, with methods for serializing to GeoJson
- Add a model that listens to a GeoPoints collection and updates a CesiumVectorData model with new geometry
- Use these in the DrawToolView
- Enable clearing a polygon
- Show on first click, line on second click, polygon on subsequent clicks

Issue #2180
@robyngit
Copy link
Member Author

robyngit commented Sep 21, 2023

The very basically functionality for drawing on the map is now in place. Here's a preview of how it looks at the moment:

Screen.Recording.2023-09-21.at.17.46.33.mov

The point data is stored in a newly created GeoPoints collection, which will allow the coordinates to be easily extracted in order to send them to an API for downloading or plotting data from the selected region.

Remaining tasks:

  • Write tests for the GeoPoints collection and the GeoPoints-VectorData connector
  • Resolve issue with displaying polygon that covers a pole
  • Improve the buttons and overall drawing UI
  • Consider showing the drawing interface separately from the side panel (so that users can, for example, interact with the layer list and draw on the map at the same time).
  • Add methods for editing & removing points, or create an issue to enhance the DrawTool with these features in the future
  • (optional) use the GeoPoints collection in the Geohash model to handle creating GeoJson (just to keep the code base more DRY)

@robyngit robyngit self-assigned this Sep 21, 2023
robyngit added a commit that referenced this issue Sep 28, 2023
- Switch from GeoJson to CZML (improves ability to draw around poles)
- Set up the DrawTool for actions like deleting & moving points, running a callback with user-created points as argument

Issue #2180
robyngit added a commit that referenced this issue Oct 6, 2023
- Fix issues with drawing polygons, including drawing polygons over poles
- Allow drawn polygons to have properties set like other layers (color, opacity, etc)
- When drawing, draw both points and polygons
- Add CustomDataSource support
- Greatly reduce the number of re-renders Cesium must do (improve map performance)
- Add connectors between GeoPoints collection and polygons & points Entities

Issues #2180 and #2189
robyngit added a commit that referenced this issue Oct 13, 2023
- In CesiumVectorData, in the new runVisualizers method, re-run in cases where visualizers are waiting for an async process to complete.
- Fixes issue with Cesium Geohashes not showing up
- Add some missing JSDocs to CesiumVectorData

Issue #2180
robyngit added a commit that referenced this issue Oct 13, 2023
- Style draw tool buttons
- Hide edit & delete point buttons for now (not implemented)
- Enable configuring hiding a layer in the layer list
- Fix issue with removing entities in CesiumVectorData

Issue #2180
robyngit added a commit that referenced this issue Oct 13, 2023
robyngit added a commit that referenced this issue Oct 16, 2023
Add an ID to the polygon created when drawing on map so that it is updated when new points are added rather than creating a new one

Issue #2180
robyngit added a commit that referenced this issue Oct 17, 2023
@robyngit robyngit linked a pull request Oct 17, 2023 that will close this issue
robyngit added a commit that referenced this issue Oct 18, 2023
- Properly switch the maps "click action" back to original setting after draw tool turned off
- Fixed delayed rendering of datasources after update (esp. Geohashes)
- Fix zooming to features on click (issue with getting bounding sphere of a feature)

Issues #2180 and #2189
robyngit added a commit that referenced this issue Oct 18, 2023
robyngit added a commit that referenced this issue Nov 1, 2023
- Wait to trigger catalog search until camera is moving has moved enough to be considered 'changed'
- Remove listeners in Map-Search-Filters connector
- Update some documentation
- Clean up some of the CesiumVectorData code

Issues #2180 and #2189
robyngit added a commit that referenced this issue Nov 1, 2023
In case there is no cesiumModel created yet.

Issues #2180 and #2189
@robyngit robyngit closed this as completed Nov 2, 2023
@robyngit robyngit added ADC CI-13 Dynamic data visualizations in portals (ADC deliverable) arctic data center labels Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADC CI-13 Dynamic data visualizations in portals (ADC deliverable) arctic data center cesium enhancement pdg Permafrost Discovery Gateway
Development

Successfully merging a pull request may close this issue.

1 participant