+ Reply to Thread
Results 1 to 9 of 9

Thread: How to use CON function

  1. #1
    Darlene Wilcox
    Join Date
    Apr 2010
    Posts
    29
    Points
    1
    Answers Provided
    0


    0

    Default How to use CON function

    I have two rasters -- one is an ORIGINAL_DEM, the second has some CORRECTED_DEM elevation values and otherwise is NODATA.

    What I want is to create a new raster, where the values are the CORRECTED elevation values where there are corrected elevation values, and otherwise are the original DEM values.

    In the Tool, I use the following:

    Input conditional raster: CORRECTED_DEM

    Expression: I tried leaving this blank, I tried "VALUE" > 0, and I tried "VALUE" <> NULL

    Input true raster: CORRECTED_DEM

    Input false raster: ORIGINAL_DEM

    In each of these cases, I get the corrected DEM values ONLY -- the rest of the values are NODATA -- that is, I'm not getting the original DEM values at all!

    Thanks for any help....

  2. #2
    Robert LeClair

    Join Date
    Nov 2009
    Posts
    315
    Points
    111
    Answers Provided
    12


    0

    Default Re: How to use CON function

    Darlene -

    Would this work in the tool GUI:

    Input conditional raster: CORRECTED_DEM

    Expression: NOT("VALUE" IS NULL)

    Input true raster: CORRECTED_DEM

    Input false raster: ORIGINAL_DEM

    Good luck!

    Robert LeClair
    Esri-Denver

  3. #3
    Darlene Wilcox
    Join Date
    Apr 2010
    Posts
    29
    Points
    1
    Answers Provided
    0


    0

    Default Re: How to use CON function

    Robert,

    Well, that gave me completely inexplicable results.

    Original_DEM: 3251 rows x 4618 columns, 3m cellsize. Min elevation, 262.03m. Max elevation 305.78m, Mean elevation 280.69m (values rounded).
    Corrected_DEM: 3251 rows x 4618 columns, 3m cellsize. Min elevation, 265.31m. Max elevation 299.39m, Mean elevation 283.40m (values rounded).

    The Corrected_DEM was created this way: Line segments were digitized where culverts needed to be "burned in" to the elevation model. Through a number of moves the line segments became the Corrected_DEM, which is NODATA off the line segments and interpolated elevation values along the line segments (now @ 10 gridcells long, each). Also, I set the environment to be the same extent and cell size as, and had the line segments snap to, the Original_DEM.

    When I did my attempts at the CON, I got ... exactly the same as my Corrected_DEM. When I did YOUR version, I got this oddball result. The properties indicate the same number of rows and columns, the same cell size, but the Min, Max, and Mean elevation values are all 264.57m (rounded) and all the values are null except for one cluster of gridcells in the far upper left of the DEM measuring about 383m x 383m. This is no where near any of the corrections.

    I did this twice -- once just putting in your suggestions, one using your suggestions AND setting the environment to match the Original_DEM. Same results both times.

    This should NOT be so difficult! Any further ideas? Thanks, Darlene

  4. #4
    Robert LeClair

    Join Date
    Nov 2009
    Posts
    315
    Points
    111
    Answers Provided
    12


    0

    Default Re: How to use CON function

    Darlene - interesting...I'm assuming your rasters are in the same projection, correct? If you're interested, you can send me your rasters to rleclair at esri dot com. I can work with the scenario and attempt to resolve it. Please advise.

  5. #5
    Darlene Wilcox
    Join Date
    Apr 2010
    Posts
    29
    Points
    1
    Answers Provided
    0


    0

    Default Re: How to use CON function

    Quote Originally Posted by rleclair View Post
    Darlene - interesting...I'm assuming your rasters are in the same projection, correct? If you're interested, you can send me your rasters to rleclair at esri dot com. I can work with the scenario and attempt to resolve it. Please advise.
    Robert, Yes, both are NAD83 UTM16N.

    I'll be glad to zip them up and email them to you, because I have to embrace ArcGIS (I'm an old, old dog, who still fumbles a bit -- make that more than a bit -- with the new tricks). Because I actually have to advance through the project, though, I reverted back to the old ways: In ArcView3.3, this produced the correct results:

    ( [Culvert_1].IsNull.Con([Cksw_03m_v0],[Culvert_1]))

    Thanks so much. Darlene

  6. #6
    Robert LeClair

    Join Date
    Nov 2009
    Posts
    315
    Points
    111
    Answers Provided
    12


    0

    Default Re: How to use CON function

    Understand Darlene - no worries. I too am an "old" dog as well - ArcInfo Workstation (v. 5.0). Progressed through ArcView 1.0, 2.0, 3.x and now the ArcGIS releases v. 8-10.0. Cheers!

  7. #7
    Robert LeClair

    Join Date
    Nov 2009
    Posts
    315
    Points
    111
    Answers Provided
    12


    0

    Default Re: How to use CON function

    Darlene -

    Here's a thought - instead of using the CON function, try the Raster Calculator instead with the following syntax:

    Con(IsNull("Corrected_DEM"),”Original_DEM, "Corrected_DEM")

    What is the result? Please advise.

    Regards,

    Robert

  8. #8
    Shaun Dillon
    Join Date
    May 2011
    Posts
    4
    Points
    1
    Answers Provided
    0


    0

    Default Re: How to use CON function

    Hi
    Dont know if I should start my own thread/question, but I think my problem is quite similar to this.
    I am trying to cut streams into my DEM. I have made my streams into rasters with a value of -1 (meters) with the rest of the raster having NoData value. I then want to make a conditional (or should I use Pick) to make a new Raster where the elevation is -1 where the streams are and otherwise have the value of the DEM. I have also tried to make a conditional expression in the Single Output Map Algebra without succes.
    Part of my problem is that I simply do not know where you write the expressions (such as "Con(IsNull("Corrected_DEM"),”Original_DEM, "Corrected_DEM")". I use ArcGIS 9.3.1 but have mainly used the toolbox tool "Con".
    Can someone explain to a newbie?
    Regards Shaun

  9. 06-18-2012 03:12 AM

    Reason
    too early in morning

  10. #9

    Join Date
    Jul 2013
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Default Re: How to use CON function

    CONDITION:

    Con(IsNull("Correct_Values_Raster"),"Original_Raster","Correct_Values_Raster")


    Explanation:

    --- Begin Statement ---

    Where the "Correct_Values_Raster" equals <NULL>,

    Use the "Original_Raster",

    Else use the "Correct_Values_Raster"

    ---End Statement ---

    I used this to 'burn in' Culverts to allow for correct stream production of a Hydrology Model.

    Set Processing Extent and Snap Raster to the "Original_Raster" under the Environment Settings.

    The output is a "New_Raster_DEM" with culvert cuts in the right places.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts