0

In QGIS, each time I reproject a file and then try to load it into a project with the same CRS I face a really weird problem which behaviour seems to me kind of unpredictable, as if QGIS is 'buggy', and I don't understand what goes wrong or how to avoid this 'error', or I may misunderstand something here: I first create a project and define the project's CRS, e.g. EPSG:25832 - ETRS89 / UTM zone 32N. Then I load my file with a different CRS, eg. EPSG:4258 - ETRS89, which lines up perfectly. Then I reproject this file by doing the following steps:

  1. Go to Properties --> Source
  2. Change the Assigned CRS to the project's (and wanted) CRS, click apply and OK

Then the Layer disappears from the map. If you then do right-click on the layer, click 'Export' --> 'Save features as' this opens the 'Save Vector layer as .. '- menu, where you can define format (e.g. Shapefile), File name, and the CRS. At this point, the CRS should already be set to the CRS you want to reproject the file to. Then click 'save'.

Then QGIS is reprojecting, and when you open the file location, you can find the .prj which has the wanted CRS (in this case the CRS EPSG:25832 - ETRS89 / UTM zone 32N ) HOWEVER, and here now it gets interesting to me, if I then load the newly projected file into the project which has the same CRS, it doesn't line up with the project EVEN THOUGH the project and the file now have the same CRS.

What am I doing wrong?

It is bugging me over and over again, and then, out of a sudden it works, however I don't know what I did differently. .... It now happened again when I wanted to do some photos, out of a sudden it works... and really, it is not that I chose the wrong CRS, it is bugging me every single time I reproject a file. There must be a small detail in the process which needs to be taken care of.

Any idea?

System: Windows 10

QGIS verson 3.28 'Firenze'

3 Answers 3

2

You are missunderstanding.

Your loaded layer does not have a "wrong" CRS.

It has the CRS it comes with. Could be WGS84,could be anything. that is the info that QGIS has about your data.

When you export you are setting the CRS you want to project your saved data to. For that, QGIS needs info on what CRS you are coming from!

And that's what you are chaing when you are changing the layer CRS with "properties".

Your slight overlap happens because your original data CRS4258 and the one you are changing to in "properties" is only "slightly" wrong compared to the one it comes with 25832

1
  • Thank you for the explanation. I changed the word 'wrong' to unwanted.
    – i.i.k.
    Commented Apr 19, 2023 at 14:40
2

Changing the assigned CRS is not the same as reprojecting the file. What you are doing is basically telling QGIS that the data you provide(e.g. x=1,y=1) is not in the CRS you initially had, but in a different one.

So it takes the same numerical values(1,1) and interprets them as "they come from another CRS".

What you need to do is to reproject the data itself.

Do so with (top menu) vector>datamanagement tools>reproject layer or raster > projections>warp

If it's not that, your reprojection algo might have some inaccuracies, depending on the CRS you are coming from and to

1
  • Thank you for answering, but see my answer below.
    – i.i.k.
    Commented Apr 19, 2023 at 14:27
0

I did find out the small detail you need to do and what NOT to do: Do NOT set the CRS in the Property section from your layer to the wanted CRS and then save the layer, but let the layer's (unwanted) CRS untouched!

enter image description here

Instead, set the CRS ONLY during the export process, otherwise you face the problem I said above.

enter image description here

Still I'm confused as what is happening, as in both methods QGIS will calculate something (to be visible at the loading symbol on the bottom) and you will end up with a .prj with the correct CRS, but only with the second one having the correct coordinates.

Is this a bug, or do I misunderstand here something?

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.