NationalSecurityAgency / qgis-shapetools-plugin

Shape Tools creates geodesic shapes and includes a number of geodesic tools for QGIS including the XY to Line tool, geodesic densify tool, geodesic line break, geodesic measure tool, geodesic measurement layer, geodesic scale, rotate and translate tool, and digitize points at an azimuth & distance tools.
GNU General Public License v2.0
154 stars 68 forks source link

Add field value or Data Defined Override to scale factor for Geodesic Transformation Tool #39

Closed anthonyblackham closed 3 years ago

anthonyblackham commented 3 years ago

This is more of a feature request than it is an issue.

There are a few functions that I think could benefit from having a field based value as opposed to a single manual input. For example with the Geodesic Transform Tool a field based value can provide greater variety when creating non-contiguous cartograms

image

I made a slight modification to the Geodesic Transform Tool to include a field as a proof of concept

image

To simplify the interface it may be more advantageous to use a data defined override where a user can either choose an integer, field or even an expression like in the default buffer tool:

image

hamiltoncj commented 3 years ago

@anthonyblackham Thanks so much for the suggestion which is resulted in a new understanding of the QGIS API. I am going to work toward the data defined override. Hopefully, I will have this working by the end of the week depend on how much time I can put on it. Depending on how this turns out, I may use this method for the rest of the algorithms rather than explicitly use a field value.

anthonyblackham commented 3 years ago

Sounds good, my coding skills are a bit rudimentary but I'm happy to test out any changes

hamiltoncj commented 3 years ago

I updated Shape Tools to version 3.3.18. I have made the rotation, scale, translation distance, translation azimuth all data defined. You might just want to test it to make sure you can't find any bugs in it. It seems to be working great for me, but I have not used some of these PyQGIS calls before and there is not much documentation or examples on implementing data defined overrides. Here is an example.

geodesictransformexample

I really appreciate knowing about data defined overrides. This is a better than just using a separate entry for the user to select an attribute.

anthonyblackham commented 3 years ago

Brilliant work, I ran it through a bunch of settings and as far as I can tell I didn't see any regressions.

I will mark this as resolved.

Thanks for the prompt update and incredibly useful plugin.