0

enter image description hereI have never worked with the raster calculator before and I can't solve my problem.

There are two raster datasets. One contains roads ( "closed", "in use", "under construction") and the other dataset contains 4 countries ("1","2","3","4"). I just want to select from roads "in use" and all the countries that contain the roads ...

I am using ArcMap 10.2.2 So I tried something like this: (in use has the Value 2)

("roads" == 2) & ("countr" == 1)

This works. But how can I get all the countries that contain that road(s)?

My goal is to compute a new output like a "Clip". Cells of roads "in use" and cells from countries should be "cliped". Is this possible using the Raster Calculator? it looks as if i didnt get the concept of Rasterdata ;-(

8
  • I'm not sure what your goal is. Raster data doesn't really work like that (ie selecting countries). When comparing or working with rasters, you're basically matching cells they have in common. So your example expression, you don't need the ==1 since that limits the comparison to pixels representing that one country. You just want roads = 2 for the entire countr raster. But that only returns the road pixels in use in all countries, not all the pixels of a country. Can you elaborate a bit more on what you want to produce, or provide a sketch/example image?
    – Chris W
    May 30, 2015 at 4:27
  • 1
    This type of analysis would be easier using vector data.
    – Aaron
    May 30, 2015 at 16:52
  • i know ;-)but i have to use Raster calculator
    – user52917
    May 30, 2015 at 17:26
  • Let's assume all the roads shown in your example are 'in use'. The result of the operation you are wanting to do will be those lines, but only where they are within a country. You won't see the country shapes at all. Is that what you want? What are the values in the rasters outside of countries or roads - are they null/nodata or set to 0 or another value? Con((("roads" == 2) AND ("countr" > 0)), 1, 0) would do it in one step if I got my syntax right.
    – Chris W
    May 30, 2015 at 22:15
  • The given example is bad ... sorry for that. There should be now gap between the countries (didn't think about that). "he result of the operation you are wanting to do will be those lines, but only where they are within a country."-> That's exactly what i want ;-) . I will try my best to understand your syntax and will give you an update if it worked. Thanks so much for your help
    – user52917
    May 31, 2015 at 5:55

2 Answers 2

1

As per the asker's comment:

Con("contr" >= 1) & ("roads" == 2),"contr",0) does exactly what i want

As per the documentation for Con, that tool:

Performs a conditional if/else evaluation on each of the input cells of an input raster.

0

The Combine tool is the raster equivalent of the Intersect tool with vector features. Combine creates a cross - reference attribute table with a row for each unique combination of raster values found.

The output of Combine can be used with table calculations to calculate percents and areas (area = COUNT * cell size squared).

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.