4

I have a shapefile created from a GPS log and containing long/lat data in the WGS 1984 format. I would like to overlay it on a raster (.tif) that has the following metadata:

Spatial data:

+proj=utm +zone=33 +ellps=WGS72 +towgs84=0,0,4.5,0,0,0.554,0.2263 +units=m +no_defs

Layer extent:

5516499.9999999925494194,4837799.9999999403953552 : 5542600.0000000819563866,4860000.0000000167638063

Google satellite aligns perfectly with the shapefile, but the shapefile and Google satellite are about 354 meters due west of the raster.

  • If Croatia, layer may be using EPSG:3907 (MGI 1901 / Balkans zone 5), which would need a +towgs84 in its definition like +towgs84=551.7,162.9,467.9,6.04,1.96,-11.38,-4.82 – mkennedy May 31 '18 at 18:00
4

Two options:

  • QGIS has a handy on-the-fly reprojection (OTF) option that will reproject all open files/layers into the designated CRS in-memory (i.e. metadata stays untouched). For visualization purposes, this does an amazingly easy job; chances are OTF is disabled in your project settings:

    Ctrl - Shift - p, the usual shortcut, or, if not set, Project -> Project Properties -> CRS
    and check Enable On-the-fly CRS Transformation and choose CRS

    (Note: location and naming depends somewhat on the QGIS version in use, but you´ll find that option somewhere there...)

  • Alternatively, you can alter the data´s CRS directly to fit each other, e.g. either

    • right-click the shapefile layer -> Save as... -> choose name and matching CRS
    • Raster -> Projections -> Transform (Reproject) -> choose name and matching CRS

Note that the second option will change the metadata of your layers; this can be useful if you plan on doing further work, especially spatial analysis, on those layers since many, if not all tools will need all input layers to be in the same CRS to get proper results (most will actually throw an error).
This equally applies to symbology and labeling, e.g. if you work with layer units; being new to this, it can sometimes be tedious to trace errors or strange behaviour back to different CRS. For simple visualization, however, OTF is gold.

4

That is too easy!!! I love QGIS because of it!

It is called "Enable 'on the fly' CRS transformation (OFT)". You then need to define the proper CRS for each layer.

enter image description here

  • Thanks for the response .... I have tried OFT to no avail. Here's what I tried: (1) select the raster properties, and choose selected CRS (EPSG:4326, WGS 84) and then the raster immediately disappears from the canvas, while the shape file remains. Alternatively, (2) I select the shape file properties and choose +proj=utm +zone=33 +ellps=WGS72 +towgs84=0,0,4.5,0,0,0.554,0.2263 +units=m +no_defs and then the shapefile disappears from the canvas while the raster remains. Any suggestions what I'm doing wrong here? – sschultz May 31 '18 at 10:52
  • @sschultz what you did there is setting the layers CRS; to change it properly, you have to reproject it (second option in my answer)! example: imagine a point with the coordinates 52°N 13° in degree - that`s around Berlin. now, if you set the CRS of this point to UTM, 52 and 13 are treated as meter - now you can see Null Island from that point. reprojecting that point would calculate the proper values between those coordinates. undo what you have done, reload those layers in QGIS and use the option in one of the answers here. – ThingumaBob May 31 '18 at 11:06
  • Thanks, but still no success. I right-clicked the shapefile, chose Save As... and then for CRS I chose +proj=utm +zone=33 +ellps=WGS72 +towgs84=0,0,4.5,0,0,0.554,0.2263 +units=m +no_defs which is the spatial data for the raster. Then what happened is that the shapefile units were converted from long/lat to UTM, but the position of the shapefile did not change. It is still about 354 meters due west of the raster. – sschultz May 31 '18 at 11:20
  • If I create a shapefile using long/lat in the Croatia format within Trimble Pathfinder Office Export Utility, then the shapefile aligns perfectly to the raster, no changes necessary. But WGS 1984, the units of my large dataset, plots at around 354 meters due west. – sschultz May 31 '18 at 11:30
  • @sschultz one thing is setting the CRS for the project (the screenshot I posted and it is there where you select the OFT option) and another is setting the CRS for each layer. If you set the CRS for the layers without the OTF option in the project, they will not match. Once you have the OFT for the project and your layer do not match, then you have a wrong assumption of the layer CRS. A good practice is having a WMS layer as background, so you easily catch up which one is wrong. – Marco May 31 '18 at 12:08

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.