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

feature: measure elevation profile #1569

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

johnnyblasta
Copy link
Collaborator

Closes #1567

Add this config option to measure control to point to a Origoserver that adds height to the geometry:

"options": {
        "elevationProfileURL": "http://localhost:3001/origoserver/lm/elevation"
}

Use this PR origo-map/origo-server#120 for setting height.

ElevationProfileNew

@tonnyandersson
Copy link
Collaborator

tonnyandersson commented Jul 19, 2022

I think there's a plugin for this. Well, not quite, but kinda.

@johnnyblasta
Copy link
Collaborator Author

I think there's a plugin for this. Well, not quite, but kinda.

Yes, I'm aware of the plugin, but there has to be a configured layer with heights on that one and since this uses the Lantmäteriet Höjd Direkt service to add the heights we thought it were appropiate to have it in measure control.

@tonnyandersson
Copy link
Collaborator

I'm sure the elevation profile plugin can be modified to make use of the LM service. There's even an open issue on this very subject.

The thing is, this feature uses the ol-ext library, which is why the elevation profile plugin was created as a plugin and not a built-in feature. Same thing with the multiselect plugin, which uses the turf.js library.

@johnnyblasta
Copy link
Collaborator Author

I'm sure the elevation profile plugin can be modified to make use of the LM service. There's even an open issue on this very subject.

Then it has to be hooked on too some draw function also to get an arbitrarily drawn objects elevation profile, which I guess could be done somehow.

The thing is, this feature uses the ol-ext library, which is why the elevation profile plugin was created as a plugin and not a built-in feature. Same thing with the multiselect plugin, which uses the turf.js library.

Hm, is there a way to build it without including the external library and those that want to use the function includes it from the html file?

@tonnyandersson
Copy link
Collaborator

Hm, is there a way to build it without including the external library and those that want to use the function includes it from the html file?

Well, I guess there is, technically. But that's bad design. Like, really bad.

I guess this raises a bunch of philosophical questions regarding plugins and non-essential external libraries that needs to be discussed in a larger forum. To me, it's a no-brainer. But this is not a dictatorship. Sadly. :)

@johnnyblasta
Copy link
Collaborator Author

Moved showing of elevation profile to plugin to lose dependency on ol-ext in Origo.
New version of plugin is on the way.

@tonnyandersson
Copy link
Collaborator

tonnyandersson commented Jul 20, 2022

So, here's my opinion.

I'm not asking you to make any changes now because I think more project members need to weigh in on this.

But.

In my opinion, plugins should be more or less self-contained, i.e. all logic, styling etc. associated with the plugin should be kept in the plugin's own repository. Sometimes it's necessary to add minor helper functions and things like that to the core, and that's fine, but other that that, the core should be kept clean.

Right now it looks like half (or more) of the elevation profile logic is placed in the measure control, and the rest of the logic is placed in the elevation profile plugin repo. This means there are large chunks of code in the core that does absolutely nothing unless you download and install the appropriate plugin. Will this lead to the Armageddon and the end of the world? No. But it may make code maintenance a whole lot harder with bits and pieces of code scattered across multiple repos.

I think it would be a better idea to upgrade the current elevation profile plugin by adding the option to use the LM elevation service. And why not add a stand-alone point-and-click type tool to it? That way it could potentially work with measure, draw and regular features. Or perhaps something completely different, I don't know.

Basically, my point is that we must try to maintain a coherent core structure and not just throw things in there because it's easy and it works. It's messy enough as it is.

@johnnyblasta johnnyblasta changed the title Measure elevation profile feature: measure elevation profile Sep 28, 2022
@johnnyblasta johnnyblasta marked this pull request as draft November 7, 2022 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

See elevation profile on measures
2 participants