3

I have several maps like this one:

Soil Use

And with the proximity tool and a coastline shapefile I made this output, representing the distance to shoreline:

Distance to Shoreline

Now, I want to combine both using the Raster Calculator. However, everytime that I make an operation, the output is just NaN.

Do you have any hint on why is that?


Solved! Both maps had different projections and the "on the fly reprojection" was activated.

4
  • You are using only Raster Calculator within the toolboxes or you ar adding something more? can you write down your sintaxis in the Raster Calculator?
    – Gsanez
    Jan 14, 2015 at 12:21
  • I'm only using the Raster Calculator normally. This for example, doesn't work: "Revestimento de Solo@1"*(1/28-0.665*("dist_linha_costa_metros_area_restrita@1"-100)/(4900*22))
    – narra89
    Jan 14, 2015 at 13:34
  • actually, the distance to shoreline layer don't work with any calculations from Raster Calculator... even "dist_linha_costa_metros_area_restrita@1"-100 does not work
    – narra89
    Jan 14, 2015 at 14:20
  • So how did you end up solving this? Jul 20, 2015 at 3:58

4 Answers 4

5

Just a guess but this often happens when the two rasters in different projections.

Try verifying that both share the same coordinate systems.

0
2

Did you check the values in your raster, if your operation makes sense? Did you double-check syntax of your expression?

I am always confused about syntax, because I just use raster calculator once in a while. I can just speak from an arcGIS point of view, but there you have a model builder and another tool from toolbox, I think it is called Single Output Map Algebra. Both allow you to just add or subtract a constant to/from your raster, like you did.

Maybe you have similar tools in QGIS you can use alternatively, to prove correctness of our approach, besides syntax? I personally do prefer those over raster calculator.

Hope that helps.

0

I'm pretty sure that the filename is the problem. 1. Too long 2. contains the "@" character.

1
  • 1
    When you already have used the raster calculator in QGIS, you know the "@1" stands for the raster band 1.
    – Stefan
    Jan 14, 2015 at 17:50
0

Also I had a problem when selecting the extent. QGIS at the moment only updates to the correct extent after you choose the output file.

With an invalid extent I was only obtaining NaN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.