Mirroring layers on QGIS?

As you state, you could do this in image processing software, but if you want to do it in QGIS for a smooth workflow (perhaps using a script or creating a processing Model), you can flip your images using the Grass function r.flip. However, this is in Grass 7 so you would need to install that as it is not yet standard in QGIS.

Also, there is SAGA's Grid Orientation tool, which offers flip, mirror and invert options. The documentation seems sparse for this but a quick experiment shows that 'flip' flips the image vertically, 'mirror' flips the image horizontally, but invert makes a 'negative' of the image (so not what you want, I suspect - but flip and mirror look promising for your use).

EDIT (re comments): To mirror, rotate or otherwise 'rubber-sheet' vector data you need affine tools. QGIS has a number of tools for this. There are a couple of plugins ('Affine' and 'Vector Bender') and Grass has v.transform. You need to compute your transformation matrix for Affine or v.transform. See this post for the former. Alternatively, if you are very familiar with rubber-sheeting rasters (and too lazy to work out transformation matricies), then use the Vector Bender plugin - though I think it would be harder to work out your mirror lines for this particular use-case (otherwise it is brilliant).

Using Affine plugin and a transformation matrix of
1,0,0
0,-1,0

I get the following (blue = before, yellow = after): enter image description here

The matrix here is actually flipping about the Y-axis, so you'd need a lateral transformation as well equal to the north-south extent of your data to flip 'in place'. So, in my case my real matrix based on this particular shapefile, would be
1,0,0
0,-1,964530.15

(i.e. I am fliping down on the Y-axis and then shifting the data back up)

EDIT #2 (An Afterthought):
If you are performing a batch process, you can get the extent through GDAL easily enough and automate the creation of the transformation matrix. However, if you are doing a semi-manual process, in your use-case you can simplify things by unioning a simple bounding-box polygon with each layer's data. That way your transformation matrix will always be the same as the total extent of your data will always be within your bounding box regardless of what you actually digitize in the layer.


Yes, you can mirror layers (or individual features). This requires QGIS >= 2.10. It's not necessary to actually modify the input data, just the way it is presented. This is done using layer effects as shown here for Alaska:

enter image description here

Tags:

Qgis