+ Reply to Thread
Results 1 to 3 of 3

Thread: ArcGIS 10 - selecting attributes from multiple bands

  1. #1
    Kath Sund
    Join Date
    Nov 2009
    Posts
    2
    Points
    0
    Answers Provided
    0


    0

    Default ArcGIS 10 - selecting attributes from multiple bands

    I would like to know the syntax for arcpy.sa or Raster Calculator to select the following:

    1. Band_1 from a raster where the Value is something specific. Do I use ExtractByAttributes? If so, what is the syntax to choose Band_1 from a multiband raster?
    2. Select from a combination of all three rasters like "Band_1","Value = 112"; "Band_2, "Value = 115"; "Band_3","Value = 5". I have no idea of the syntax for this.

    http://help.arcgis.com/en/arcgisdesk...0029000000.htm explains that you can use multiband rasters, but doesn't explain the syntax to do this.

    Any help would be greatly appreciated.

    Thanks

    KS

  2. #2
    Charles Morton
    Join Date
    Nov 2010
    Posts
    6
    Points
    0
    Answers Provided
    0


    0

    Default Re: ArcGIS 10 - selecting attributes from multiple bands

    In a python script using arcpy, to select a single band from a multi-band raster, just append "\\Layer_X" onto the path name. For example, my multi-band raster is "D:\\temp\\test.img" (or r"D:\temp\test.img" or 'D:/temp/test.img'). The second band would be "D:\\temp\\test.img\\Layer_2". Actually it could be called something other than Layer_X, you just have to look at how it is named when you load the raster into ArcMap (in ArcGIS 9 I think they were all named band_X).

    To get the part of a raster with a specific value in a python script, you can use simple conditionals. I'm not totally sure this is what you want, but maybe it will help:
    Code:
    import arcpy
    arcpy.CheckOutExtension("Spatial")
    input_raster = "D:\\temp\\test.img"
    band1_obj = arcpy.sa.Raster(input_raster+"\\Layer_1")
    band2_obj = arcpy.sa.Raster(input_raster+"\\Layer_2")
    band3_obj = arcpy.sa.Raster(input_raster+"\\Layer_3")
    output_obj = (band1_obj == 112) & (band2_obj == 115) & (band3_obj == 5)
    output_obj.save(r"D:\\temp\\output.img")
    I'm not sure how to do this in raster calculator. I was actually trying to figure that out when I found your post, but it is probably very similar though.

  3. #3
    Pavan Yadav
    Join Date
    Dec 2009
    Posts
    56
    Points
    7
    Answers Provided
    0


    0

    Default Re: ArcGIS 10 - selecting attributes from multiple bands

    In ArcGIS 9.x Raster Catalog, you can use a syntax like this:
    [KALI-1415.jpg - Band_1] <= 50 & [KALI-1415.jpg - Band_2] >= 120 & [KALI-1415.jpg - Band_3] <= 173

    In ArcGIS 10 Raster Catalog, use full catalog path names instead of layer names in the expression.

    (("C:\Test\KALI-1415.jpg\Band_1") <= 50) & (("C:\Test\KALI-1415.jpg\Band_2") >= 120) & (("C:\Test\KALI-1415.jpg\Band_3") <= 173)

    *KALI-1415.jpg is my example image.

+ Reply to Thread

Tags for this 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