Thursday, 25 April 2019

Resizing shapefile features proportionally in QGIS


In QGIS (1.8.0-Lisboa) on Windows (OSGeo4W Install), how would you resize a feature proportionally?


The only way I've found to do this is by hand using either the Freehand Editing (0.2.6) plugin or the Reshape Features button. Neither of these provides a means to uniformly scale (as in resize) the selected feature up or down.


For example, I want to increase the features size by 130% so that you retain the shape of the feature but expand the area of the shape itself proportionally in all directions.



Answer



In QGIS you can use the Affine functions for scaling vector features. In the Vector menu:



enter image description here


And the dialog looks like this:


enter image description here


If you enter 1.3 in both the "Scale X" and "Scale Y" boxes, then the layer (or just the selected feature(s) will be scaled up by 130%. This operation will scale the features proportionally, but be aware that depending on the coordinate reference system (CRS) you are using the results may look warped. For example, if you are using a Mercator projection and scale a large polygon near to the north or south pole, then it will appear to stretch more the closer it is to the pole. For smaller polygons near the center of the given CRS there will be no noticeable distortion.


To see what I mean about distortions, try the Mercator Puzzle. It's fun!


Update (January 2019) for QGIS 3.4: Affine transformations can be are available through the Processing Toolbox with the GRASS algorithm v.transform.


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...