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

feat: distance measurement for line strings #1308

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

spectrachrome
Copy link
Member

@spectrachrome spectrachrome commented Oct 9, 2024

Implemented changes

Enables the map and draw tools to display a geographically accurate distance measurement on the surface of Earth for lines drawn by the user.

Two conditions must be fulfilled in order for the measuring tooltip to appear:

  • The draw tools are configured to do measurements (with <eox-drawtools measure>)
  • The draw tools' current draw type is LineString.

As long as these are configured, the measuring tooltip should show up automatically, as can be seen in the Distance Measurement story in the Draw Tools.

Due to a large increase in complexity regarding the tooltip alignment, area measurements will not be implemented for now, even if the calculation works fine. If desired, that will follow in another PR.

Screenshots/Videos

Screen Recording 2024-10-30 at 15 55 20

Checklist before requesting a review

Copy link

netlify bot commented Oct 9, 2024

Deploy Preview for eoxelements ready!

Name Link
🔨 Latest commit 58ca335
🔍 Latest deploy log https://app.netlify.com/sites/eoxelements/deploys/675028099f5c1a00082e31f5
😎 Deploy Preview https://deploy-preview-1308--eoxelements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@spectrachrome spectrachrome changed the title feat: line/area measurements feat: allow distance measurements using line strings Oct 30, 2024
@spectrachrome spectrachrome self-assigned this Oct 30, 2024
@spectrachrome spectrachrome added the enhancement New feature or request label Oct 30, 2024
@spectrachrome spectrachrome changed the title feat: allow distance measurements using line strings feat: allow distance measurements using measure attribute line strings Oct 30, 2024
@spectrachrome spectrachrome changed the title feat: allow distance measurements using measure attribute line strings feat: allow distance measurements using measure attribute and line strings Oct 30, 2024
@spectrachrome spectrachrome marked this pull request as ready for review October 30, 2024 20:32
@spectrachrome spectrachrome changed the title feat: allow distance measurements using measure attribute and line strings feat: allow distance measurements using the map's measure attribute and line strings Oct 30, 2024
@spectrachrome spectrachrome changed the title feat: allow distance measurements using the map's measure attribute and line strings feat: allow distance measurements using the map’s measure attribute and line strings Oct 30, 2024
@spectrachrome spectrachrome changed the title feat: allow distance measurements using the map’s measure attribute and line strings feat: allow distance measurements for line strings Oct 30, 2024
@spectrachrome spectrachrome changed the title feat: allow distance measurements for line strings feat: distance measurements for line strings Oct 30, 2024
@spectrachrome spectrachrome changed the title feat: distance measurements for line strings feat: distance measurement for line strings Oct 30, 2024
Copy link
Collaborator

@silvester-pari silvester-pari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way it is currently set up would mean we could add this rather as a functionality to eox-map, instead of eox-drawtools, right? Seeing that there is no logic in the drawtools itswelf (besides the overlay clearing)

* @param {Polygon} polygon The polygon.
* @return {string} Formatted area.
*/
const _formatArea = function (polygon) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere? It would be nice to support both lenght as well as area measurement.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as currently implemented we would add it as a feature of the map, since that is where the OL interaction is created.

Currently this is not used, since the goal is mostly to determine distances in the GTIF apps. Question with two-dimensional measurements is also how the tooltip should behave (properly centered or stationary in a corner of the map).

Copy link
Collaborator

@silvester-pari silvester-pari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should reconsider if this makes sense this way, as it implements a functionality in the eox-map but "sells" it as drawtools-functionality. Also, I'd suggest we either only support line strings and remove the code regarding area measurement, or we also support area measurement. Plus hopefully we find a way to test the new functionalities...

@silvester-pari silvester-pari marked this pull request as draft December 12, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drawtools enhancement New feature or request map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants