2

I have got a raster file and a vector file of a UK which I try to overlap to use zonal statistics. The files according to the data providers are projected in British National Grid (EPSG 27700). However, when I load the 2 files, QGIS first fails to recongize the correct CRS and creates a custom CRS for each.

For the vector: +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601272 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs

For the raster: +proj=tmerc +lat_0=49 +lon_0=0 +k=1 +x_0=400000 +y_0=-100000 +ellps=airy +units=km +no_defs

The resulting image I get enter image description here

Although the maps are overlapping visually, zonal statistics does not output anything. When I set both files CRS to EPSG 27700, I get the following: enter image description here

The raster file is the small point in the centre, it is much smaller and is rotated.

How could I align the two maps?

Anton Kram
  • 21
  • 2
  • 1
    Have you tried saving them both from their initially loaded states to a new file each with 27700 set as the file CRS? – Phil G Nov 11 '16 at 13:11
  • @phil-g, yes, it did not work – Anton Kram Nov 11 '16 at 13:22
  • Are you reprojecting to anything on-the-fly? If so have you tried turning on-the-fly projection off? – Phil G Nov 11 '16 at 13:46
  • @philg, i tried turning it on/off and also nothing changed. When I saved the files as you recommended, the image I get is similar to the first picture attached where the maps are side-to-side. However, zonal statistics still outputs zero. – Anton Kram Nov 11 '16 at 13:55
  • What coordinate value are you given for the Isles of Scilly (cluster in bottom left corner) when both datasets are displayed overlapping partially? Should be in the region of 090xxx 013xxx. As they will differ, which of the two datasets is closer? I suspect the Boundary Line vector data is correct in this case. – Phil G Nov 11 '16 at 14:10
  • The following answer suggests that perhaps it could be due to the georeference rather than spatial ref: http://gis.stackexchange.com/questions/134617/how-to-match-a-raster-netcdf-data-with-a-vector-layer-in-qgis/134671# – Matthew Snape Nov 11 '16 at 14:23
  • 1
    Just tested your raster custom CRS with two identical layers (both equivalent to your vector layer actually) and I noticed that the units are set to km. Changing this to m results in an overlapping of both datasets to the same degree as yours. That said - changing the -lon offset from 0 to -2 results in an exact match. – Phil G Nov 11 '16 at 15:32
  • Are you able to share the raster file or its source? – Phil G Nov 11 '16 at 15:41
  • Can you add an openstreetmap background to see which layer is placed corectly? The vector layer has the same parameters as EPSG:27700. So you might try +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601272 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=km +no_def for the raster. – AndreJ Nov 11 '16 at 19:47

0 Answers0