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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jan 14, 2015 at 11:47
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? Commented 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)) Commented 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 Commented Jan 14, 2015 at 14:20
  • So how did you end up solving this? Commented 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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Jan 14, 2015 at 19:21
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.

answered Jan 14, 2015 at 16:12
0

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

answered Jan 14, 2015 at 17:39
1
  • 1
    When you already have used the raster calculator in QGIS, you know the "@1" stands for the raster band 1. Commented 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

answered Oct 11, 2017 at 15:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.