How do I change the projection of my shapefile using QGIS?
The default projection is set to EPSG:3003, I want to change it to wgs84 EPSG:32632. When I do a reprojection or I change projection in the properties mask I don't have the correct result.
On the left I have the plan coordinates but they are not correct for the EPSG shown on the right:
Answer
There are three different ways to change/manipulate projections in QGIS:
1. Project Properties > CRS (or you can click on the icon where EPSG is written in the bottom right corner)
This defines the proprieties of the canvas (the background layer). For exemple, if I want to display a background map from openlayers plugin (google street etc.) I will need to set the project CRS to EPSG:3857.
2. Right click on vector layer > Set Layer CRS
This will force QGIS to accept the CRS that you define, whetever the metadata or previous settings might say. Essentially you are overruling whatever was there previously. If you have ended up with some data that has no CRS defined, and you know what it should be, this is the one to use. It should be noted that this does not modify the actual shapefile (unlike when you set a CRS in ArcCatalog), it only modifies the layer properties.
3. Right click on vector layer > Save As...
Here you can set the CRS when you save your data. If you select a new CRS, this will transform the coordinates of the data the new coordinate system and save the result in appropriate file. Depending on what you select you will also get to specify the transformation method. This is used when you already have your data in the correct CRS, but you want to save it in a different projection.
You can also activate the projection "on the fly" (and then "OTF" will appear next to the EPSG projection at the bottom right corner of the main window). This can be useful as it allows QGIS to handle layers with different CRS and to show them simultaneously on the same map without having to manually change the CRS.
Here a visual example to show the difference. I would like to plot a map showing some measurement points in the Jakarta Bay, a grid that created of the Jakarta Bay and in the background a google map:
Because my default CRS is EPSG:4326, when I open a new project and try to add an openlayers map such as google physical I obtain an error.
So I need to change to EPSG:3857 and then it will work. For the moment I still can't see the map, but it will appear once I will add an appropriate vector layer.
When I add the grid layer it doesn't show. Looking into the proprieties of the layer indicates to me the CRS is EPSG:4326. I don't know for what reason but this is not the correct CRS for this layer (probably I did a wrong manipulation and changed it in the past). In this case I have to indicate the correct CRS: "Set Layer CRS" (as in 2 above) and set it to EPSG:32748. After that the layer will appear with the google map. Only now I can permanently change the CRS of the layer: "save as" and choose the same CRS than for the google map (EPSG:3857). If you try to do this manipulation before choosing the original CRS you'll get an error.
... after setting the original CRS (as in 2)
.. after saving to a new shapefile (as in 3)
When I import my measurement points I have the same problem as before because QGIS chooses by default to set the CRS to EPSG:4326 (you can change that in preferences > CRS). So I will again do "action 2".
And then again action 1.
And finally...
No comments:
Post a Comment