-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Generating profiles using profile rest API #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
niiiiiiiiice! looking forward to seeing a demo!
Just posted a demo v0.1 in the PR description (several things still missing). |
I don't the the demo. |
Sorry, don't know what happened with the demo. Just reposted it in the description. I'll update the description with missing stuff so that you get an idea on its status. |
Cool, good job!!! |
@3nids I think we've reached the goals for this PR. I'd appreciate if you can give it a test and check if the code looks good for you. I'll add an up-to-date screencast to the PR description in a while. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking awesome!
snapped_z = (dy / dx) * (point.distance() - prev_distance) + prev_elevation | ||
|
||
if abs(point.elevation() - snapped_z) > context.maximumSurfaceElevationDelta: | ||
return QgsProfileSnapResult() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not exactly sure, is it ok to exit the loop here, no chance to get a good result at a next iteration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I borrowed the code from the current QGIS profile implementation, but giving it a deeper read, I see that we can only reach that if
clause (line 103) if we're already in the good profile segment (i.e., see line 98's condition), so if we don't return immediately, we'll be accepting the previous if
condition (line 98) evaluation for all the other segments where the initial point distance value is not included. All other segments would be rejected as the condition prev_distance <= point.distance() <= k
won't be met. So, returning in line 104 is allowing us to avoid line 98's if
condition being evaluated repeatedly without never really entering it again.
try: | ||
from swiss_locator.core.profiles.profile_generator import SwissProfileSource | ||
except ImportError: | ||
# Should fail only for QGIS < 3.26, where profiles weren't available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Should fail only for QGIS < 3.26, where profiles weren't available | |
# Should fail only for QGIS <= 3.36, where profiles weren't available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, it's 3.26, since that's the QGIS version where Profile functionality landed.
However, I'm checking against 3.37, because before 3.37 we cannot really register any QgsAbstractProfileSource
subclass.
… create profiles via profile API
…n's initGui() and unregister it from registry in plugin's unload()
…his method), fix cross_section_geometries append
…fier as swiss-profile-web-service
…even if we can subclass it, we won't be able to register it anyways); handle exceptions when reading service responses
Rebasing to solve conflicts with the recently merged VectorTiles branch. |
Awesome! |
Just passing by to also drop a "awesome!" here :) |
Thank you! |
Pending:
wontfix
for now).vokoscreenNG-2024-05-07_14-55-55.mp4