-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add a new Measure Radius tool to measure map tools #60015
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Thanks @benwirf!
|
Hi @agiudiceandrea, thanks for the feedback. On the first point, do you mean adding a circular rubber band to the existing Measure Distance tool? I suppose it could be added there, but since the measure distance tool can consist of multiple consecutive line segments, would you envisage the rubber band be added to each segment as it is being drawn? or the first segment only? I'm not sure if that would fit with the multi-segment/ path drawing functionality and I feel that it could be annoying.
By some basic tests/ comparisons, the results seem equivalent to buffering points in various CRS's and would be subject to the same inaccuracies. Results should be fairly accurate in local projected CRS and less so (to outrageously wrong) in other (global) CRS's e.g. web mercator (which should not be used for distance calculations anyway). And obviously results would be worse over larger distances and further from the equator in those distorted CRSs. To an extent, I think the same issues would affect the other measuring tools. Therefore, I think there is still usefulness to this tool as a complement to the others (unless my whole idea here is flawed)! If you can suggest a better approach I'm all ears :-) |
Yes, I mean I think the functionality may be added to the "Measure Line" tool for the latest segment being drawn, with an option to enable or disable it (default disabled).
When the ellipsoidal measurement mode is set, IMHO it shouldn't be correct to always draw a circle as the locus of points equidistant from the start point (which the "circular" rubber band should represent). Otherwise the user may be misled to think the all the points on that circle's circumference are at the same ellipsoidal distance for the start point, while it is not generally the case. |
A couple of general thoughts (I can't review code till February, I'm away from my PC till then):
|
Hi @nyalldawson, thank you for the feedback. I will remove the rubber band color option! I will also look at implementations of geodesic buffering to create the rubber band geometry when 'ellipsoidal' is checked. I will be offline myself over the weekend, but will do some more work on this next week. |
@benwirf thinking more about it, you probably want to use the approach outlined in https://gis.stackexchange.com/questions/121489/1km-circles-around-lat-long-points-in-many-places-in-world/121539#121539 . Wrap it up nicely in a function in QgsDistanceArea which takes a point centre argument, radius and "number of vertices"/densification argument and you've got a winner 👍 |
I would expect a Measure Radius tool to be what is described in #59969 |
Thank you all for the feedback. I will certainly do some major reworking of this PR in the next week. @nyalldawson, thanks for the GISSE link. I was also doing some digging and found some potential inspiration here: Approximating Geodesic Buffers with PyQGIS, which seems a similar approach i.e. using a custom azimuthal equidistant projection centered on the point. |
Description
Based on feedback, I am going to rework this proposal in the coming days.
This PR would add a new Measure Radius map tool.
Although it is now closed, this does address the original request of #55523 which was a circular radius measuring tool in core.
Initially, I started writing new map tool & dialog classes, but quickly realized it would be better and more efficient to re-use the existing map tool & dialog. Hence, the
QgsMeasureTool
class is modified to include an additionalmeasureRadius
boolean parameter in the constructor. Theqgsmeasurebase.ui
is not touched, but is modified inqgsmeasuredialog.cpp
to hide the table and add line edits showing the x & y coordinates of the center & exterior points defining the radius. The existing point and line rubber bands are also re-used, with a circular polygon rubber band added which is set to a polygon geometry created via theQgsCircle
class. The general behavior is that a left click starts measuring, left click while measuring resets the rubber bands & restarts measuring; right click stops measuring and keeps the rubber bands visible until user left-clicks again, hits escape to restart, clicks New button on dialog, closes the dialog or changes tool.I've added a
QgsColorButton
in the Measure Tool section of the map tools options dialog, enabling the user to change the circular rubber band color. The selected color is stored and retrieved via aQgsSettingsEntryColor
inQgsSettingsRegistryCore
(maybe it would be better inQgsSettingsRegistryGui
?)Some additional screenshots/screencasts below:
Modified dialog for Measure Radius tool.
Measure Radius icon.
Changing project CRS.
Please note: I still need to update the tests for
QgsMeasureTool
but it's taken me a bit to get to this point so I'm keen to just test the waters and get some feedback first.@nyalldawson, I would certainly appreciate your opinion here (is this any good & a worthwhile addition to core?). Also- should I create a QEP as per: qgis/QGIS-Enhancement-Proposals#310?