I wanted to re-project a QGIS project, but there is no such option. When searching for an answer I see ogr2ogr suggested for this task, by re-projecting each vector layer (shapefile in this example). However I don't get expected result:

C:\temp>ogrinfo -al -so misc.shp
INFO: Open of `misc.shp'
      using driver `ESRI Shapefile' successful.

Layer name: misc
Geometry: Line String
Feature Count: 10
Extent: (21.267388, 42.015857) - (21.270225, 42.017470)
Layer SRS WKT:
id: Integer (10.0)

C:\temp>ogr2ogr -t_srs EPSG:4326 misc_re.shp misc.shp

C:\temp>ogrinfo -al -so misc_re.shp
INFO: Open of `misc_re.shp'
      using driver `ESRI Shapefile' successful.

Layer name: misc_re
Geometry: Line String
Feature Count: 10
Extent: (-34.004490, 0.000230) - (-34.004490, 0.000230)
Layer SRS WKT:
id: Integer (10.0)

So new file has changed geographic coordinate system, but it's not projected.
How to do that?

  • Are you trying to reproject a shapefile? A project file has a .qqs ending, a shapefile ends with .shp. I don't think you can re-project a project file but I could be wrong.
    – djq
    Dec 12 '12 at 22:28
  • 1
    I assume you already know the "on the fly" reprojection in QGIS that enables reprojecting any vector layer.
    – steko
    Dec 12 '12 at 22:31
  • @steko: If "on the fly" is what is answered by djq, yes I already knew that.
    – zetah
    Dec 12 '12 at 22:50
  • 1
    No, that is another way and it will permanently change the data. On the fly reprojection is only defined in the QGIS project and will affect how the layers are visualized but not touch the underlying files.
    – steko
    Dec 13 '12 at 11:52
  • Thanks I didn't know about that, and Googling it showed me what you meant. It's exactly what I needed. If you could have only posted your last comment yesterday... I did lot of typing to get there ;)
    – zetah
    Dec 13 '12 at 15:12

Assuming you want to reproject a shapefile, one way within QGIS is to load the file, right-click on the layer, select Save As…, and then the following window appears:

enter image description here

If you click browse beside CRS you can choose a new projection to save your file in.


To reproject all shapfiles in the one folder, something like this could work:

set "str1=_projected"
for %f in (E:\data\*.shp) do ogr2ogr -t_srs EPSG:4326 %str1%"misc_re.shp %f

(I haven't tested this and am unfamiliar with string concatenation on windows, nor am I solving the ogr2ogr issue - but this code snippet loops through a folder and runs something on each file.)

  • Yes that's great, but I would have to do that for every layer, which is time consuming. By using command line I was hoping to re-project all shapefiles at once (with for loop)
    – zetah
    Dec 12 '12 at 22:48
  • Are all the shapefiles in the one folder?
    – djq
    Dec 12 '12 at 22:54
  • Yes, they are in same folder
    – zetah
    Dec 12 '12 at 22:55
  • thanks for your effort, but did you actually read my question?
    – zetah
    Dec 12 '12 at 23:18
  • 3
    yes... you can't reproject a qgis project file which is why I gave my first answer. Then I realized you wanted to reproject the shapefiles in bulk. One way of doing this is to loop through all the files in a folder using the command line with ogr (another would be to see if you can pass ogr a folder of shapefiles).
    – djq
    Dec 12 '12 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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