I am using QGIS 2.8.2. My project includes a raster layer of flow depth representing the output from a flood simulation (.DAT file). It also includes a vector layer of points representing the centroids of buildings within the inundated area. I am simply trying to query the raster pixel values (flow depth) at the building centroid locations using Point Sampling Tool, but am receiving NULL values for every entry.

I cannot attach the project files, as it is private data, but a screengrab is here:

enter image description here

  • The CRS is the same for both the raster layer and point layer (EPSG:2452. This is also set as the CRS for the project, seen bottom-right of the raster layer). The CRSs were set and checked using the "Coordinate Reference System Selector" form accessed by right-clicking the layers and selecting "Set Layer CRS".

  • The two layers definitely overlap (see screengrab, the black points show the building centroids).

  • The raster layer is correctly selected using the point selection tool form (see screen grab. There is only one raster layer and one point layer, so no possibility of error).

  • The raster .DAT file imports fine (using Layer -> Add Layer -> Add Raster Layer), and visualizes correctly (pixel values are correct, band rendering displays the pixel values correctly-see screengrab-, the properties histogram for the layer shows the correct distribution of pixel values).

  • The output layer from the Point Sampling Tool has the correct number of entries (19,814) so the layer containing the sampling points (building centroids) appears to be correctly used.

Previous queries regarding this problem have all been solved by checking that the CRS is the same for both layers. They are the same in my case, and so my question is:

If the CRS is the same for the sampling point layer and raster layer, and the layers are shown to overlap, why is the point sampling tool returning NULL values for every point?

1 Answer 1


In your (excellent) description of the problem, one thing worries me: your use of the "Set Layer CRS". This should almost never be used, and often causes trouble. THis option has only one (rarely needed) purpose: If you load a layer which:

  1. Is lacking a CRS definition AND
  2. You know in advance what the correct CRS is

then you can attach the correct CRS definition to the layer.

But, if both data layers were from the start in the same CRS you should NOT need to "Set Layer CRS".

Can you verify if "On the Fly" reprojection is active? If not, activate it, then check if the layers still overlap.

=== Continuation ===

The next thing I would try: do the same procedure using GRASS. Here are the steps:

  1. Start GRASS and create a new LOCATION based on the EPSG:2452 CRS
  2. Import both your flood depth raster and the building centroids into this LOCATION using the modules r.in.gdal and v.in.ogr
  3. Get the raster values at each point location. First add a column to hold the raster values: v.db.addcol map=<centroids> column="flood_depth DOUBLE PRECISION" or alternatively, if there is no database yet for the centoids v.db.addtable map=<centroids> column="flood_depth DOUBLE PRECISION"
  4. Now run v.what.rast vector=<centroids> raster=<flood_depth_raster> column=flood_depth

You should now have an attribute column in the centoids vector with flood depths at each location.

  • Thanks for your comment. I have now disabled "on the fly" CRS (via Project -> Project Properties -> CRS tab -> uncheck "Enable 'on the fly' CRS transformation)
    – JLDCM
    Commented May 21, 2015 at 13:22
  • The layers have not moved (i.e. everything is still as-per the screengrab in the main description of the problem above, and the layers do appear to still overlap). I have checked the CRS for each layer (via right-click on layer->properties->General->CRS), they are both EPSG:2452. I have also checked the Layer Spatial Reference System (via right-clk->properties->Metadata->Layer Spatial Reference System), they both read: +proj=tmerc +lat_0=40 +lon_0=140.8333333333333 +k=0.9999 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
    – JLDCM
    Commented May 21, 2015 at 13:35
  • OK, you would see identical CRS information in the Metadata since you had already set that using "Set Layer CRS". I added a second option to accomplish the task with GRASS, if you choose. Edited in the above answer.
    – Micha
    Commented May 22, 2015 at 8:50

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.