2

I am working with an elevation raster from the Federal Agency for Cartography and Geodesy in Germany. Unfortunately, the CRS of the raster is unknown. Now I am trying to identify the correct CRS, so that I can polygonize the raster and merge it with my other shapefiles all of which are referenced in EPSG:31467.

This link leads to the description (in German) of the raster file and this link starts the download of the raster as .zip.

I have tried the following steps for this list of CRS. EPSG:3246, EPSG:31467, EPSG:25832 and ETRS89.

  1. Inspect the raster --> has unknown CRS
  2. Polygonize the raster using the polygonize tool
  3. Assign CRS using the assign projection tool
  4. Save the resulting shapefile as EPSG:31467 using Export: Save Features as
  5. Load the EPSG:31467 shapefile with other shapefiles with the same CRS

I did this for all CRS listed above and in all cases the resulting shapefiles with previously unknown CRS was not located where all the other EPSG:31467 shapefiles were.

I am working with QGIS 3.16.

Solution: The answers below by Babel and Zman3 are both right and the error cannot be reproduced for the raster file under the download link. It turns out that I was working with a previous version of the raster file that I downloaded a few months ago. The old version did not use EPSG:35832 and so reprojecting as such did not yield the correct placement relative to the basemap.

12
  • 1
    Are you using Assing projection?
    – BERA
    Mar 16 at 18:13
  • 2
    The EPSG code for the downloaded asc grid is given as EPSG:25832 in the accompanying prj file.
    – nmtoken
    Mar 16 at 18:57
  • 1
    What do you mean by "I have tried various CRS' - what exactly did you do?
    – Babel
    Mar 16 at 19:06
  • 2
    Unless you absolutely know for sure what your projection is (this case is okay), never assign it to a layer. Always reproject.
    – Binx
    Mar 16 at 22:32
  • 3
    @Zman3 - just to avoid confusion: sometimes you have to assign CRS - in this case, it doesn't help to reproject. But for sure, you should know what to do. As a rule of thumb: if the layer shows up in the right place, do not assign/set CRS - you are fine, however, to reproject. If the layer does not show up in the right place, you must assign the correct CRS. See here: gis.stackexchange.com/a/383437/88814
    – Babel
    Mar 16 at 23:19

3 Answers 3

2

Try the following workflow. First, you have to assign the correct CRS to the raster before you do anything else - if the raster's CRS is not correctly defined, any further step will just reproduce this error.

  1. Add a basemap to check if the raster is in the right place (e.g. adding OpenStreetMap from XYZ tiles).

  2. Open the raster in QGIS (drag and drop the file to the QGIS main window)

  3. Your raster has an unknown CRS - set the raster's CRS to EPSG:25823 as proposed by @nmtoken - I tried it with your data - it worked.

  4. Use the polygonize tool and save the result, selecting any CRS you like in the export dialog (=reproject).

Always make sure your layers are in the correct place on Earth's surface. This is why you should always have a basemap in the background: than you immediately see if layers are way off. In this case or if the CRS of the layer is not recognized correctly, assigning the correct CRS is the only way to get things right.

Afterwards, proceed with whatever you want to do - including reprojecting. But never reproject a layer that has unknown or wrong CRS - repreojecting an error retains the error.

4
  • Not sure you can specify the CRS within the Polygonize tool, unless you can set it in the Additional command-line parameters. If not, just use Reproject layer.
    – Binx
    Mar 16 at 22:30
  • 1
    Before you do anything (be it polygonize, reproject or whatever), you must make sure the layer is in the correct place on Earth's surface. So this is why adding a basemap is crucial to check that. If the layer is not in the correct place, there is no other solution than to assign the correct CRS. If you have the layer with the correct CRS, it shows up where it should be: then you can do whatever you want: polygonize, reproject etc.
    – Babel
    Mar 16 at 23:21
  • Thank you for your help, Babel. When I add the basemap, the raster is not in the place where it should be. When I use GDAL's "assign reprojection" and set it to EPSG:25832, the raster still is not in the right place relative to the basemap. When I check the properties of the raster after assigning, it still does not show the CRS. When I save the raster, assigning the new CRS and then reload it, it is still not the in the right place relative to the basemap. I must be missing something. I must be missing something in trying to replicate your steps. Mar 17 at 6:17
  • @eigenvector - load the layer into QGIS and double click on it. Go to the Source tab and click on the little button next to the drop down menu select CRS. Find the one you want. Does that put you in the correct location?
    – Binx
    Mar 17 at 13:58
1

I am unsure I can reproduce your problem with the link that you provided.

  1. I downloaded the data and simply drug and dropped the dgm200_utm32s.asc file into my QGIS (3.16).

  2. The project was already set correctly (image 1).

  3. I used the polygonize tool (image 2)

  4. Received the expected output (image 3).

  5. Reprojected the output.shp (image4)

enter image description here

enter image description here

enter image description here

enter image description here

1

There is a Find projection tool for this task.

2
  • That's pretty cool! I always thought that you had to just pretty much guess if you didn't know the projection and only had the extent values. Thanks for the share! Looks like it is only for vector files though.
    – Binx
    Mar 21 at 21:41
  • @Zman3 The image can be vectorized before processing. Mar 22 at 4:17

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.