I'd like to be able to consolidate not only the layers of a QGIS project (using QConsolidate) but also the projections used by each layer. On-the-fly projection reduces performance in QGIS, and this is particularly problematic when working on a slow platform such as an Android tablet; ideally I'd like to be able to quickly recreate a project with all its layers in a single CRS and turn off on-the-fly projection.

Is there a plugin that could take a selected set of vector or raster layers and reproject them, renaming appropriately? Is this perhaps something that could be done directly from the Python console, iterating over selected layers?

3 Answers 3


Using QGIS/OGR under Ubuntu 12.04.

One way of batch transforming all of the shapefiles in a directory from one CRS to a different one would be to use a shell script. For example, this script would transform all of the shapefiles in a directory from EPSG:27700 to EPSG:32630, renaming the output shapefiles.

for f in *.shp
  echo "Processing $f"
ogr2ogr -s_srs "EPSG:27700" -t_srs "EPSG:32630" $f-32630.shp $f

You could save the above to a text file called (say) ogr_transform.sh and run it with the command "sh ogr_transform.sh". The EPSG codes for source and target CRSs would need editing to meet your needs. In the "$f-32630.shp" statement the "-32630" specifies the text that will be added to the original file name when renaming, you'll probably want to change this too.

The script assumes that all of the files to be transformed have a single CRS. It is possible that dropping the source CRS definition (-s_srs "EPSG:27700") might make ogr read the CRSs of the input shapefiles from their *.prj files, so it might be possible to use the script to transform input shapefiles having differing CRSs to a new CRS. Please note that I have not tested this.

An afterthought: The shell script doesn't have to be run from a terminal. If in the file manager you right-click on the *.sh file and go "Properties" then click the "Permissions" tab you can enable "Allow this file to run as a program". Doing this will allow the script to be run by double-clicking on it in the file manager. Just for your 'regular' users :)


enter image description here

  • Nice script idea. I used something similar the other day to upload a whole bunch of .GPX tracks to a spatialite file. I will test the idea of dropping the input CRS and see if OGR deals with the transform anyway!
    – Simbamangu
    Oct 24, 2013 at 13:55
  • Good idea. Does this script only work if all shapes are in one directory or can you run it on shapefiles in sub-directories as well? If so: is it possible to have the files saved in the sub-directory of origin? Jan 2, 2017 at 13:51

For rasters use the "warp" tool in the raster menu, it works also in batch mode. For vectors just use the "save as..." Dialog.

  • 1
    For vector layers, ogr2ogr can transform from one crs to another using -t_srs. Batch processing should be possible on operating system level.
    – AndreJ
    Aug 24, 2012 at 12:56
  • @Giovanni Manghi - nice, hadn't realised that the 'warp' tool worked on whole directories; this will, however, not help when there are a mix of source SRSs. I have tried the 'save as' dialogue but it seems to only work for a single vector at a time?
    – Simbamangu
    Aug 24, 2012 at 13:05
  • 1
    If you need it should not be hard to make a plugin to do this task (convert a set of set of vectors and rasters with mixed crs to copies with the same crs and add them to the qgis project). If you want drop me a line privately. Aug 24, 2012 at 15:53
  • 1
    Wouldn't it be good to add this feature to the Qconsolidate plugin?
    – AndreJ
    Aug 25, 2012 at 5:06

I wouldnt worry about creating a plugin for this task - I agree with Andree.

This is a good time to get familiar with OGR - specifically ogr2ogr. You can re-project, rename, migrate and a whole lot more with a simple command line.


Here is an example: ogr2ogr -t_srs EPSG:(code) (output).shp (input).shp

  • 2
    I'm familiar with it - and tend to do a lot of my work in R or the command line - but am always looking for solutions that will make things convenient for 'regular' users (writing a manual on using QGIS for field science work).
    – Simbamangu
    Aug 25, 2012 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.