2

I have at hand this already classified image with 8 vegetation classes. Now I would want to change a part of existing vegetation class to a NEW vegetation class, making it 9 classes.

I do not want to reclassify the image as it will take some time. Also, I just needed to change few polygons for the 9th class.

How can I do this?

Is there a way to change the class manually?

I have ENVI 5.2 and ArcMap 10.2.

This is a portion of the original image with 8 classes:

enter image description here

This is a portion of the new 9th class:

enter image description here

This is how I want it to be (In here, as just did an overlay for visualization purposes. Can the CON tool add the new class 9 to the original image?)

enter image description here

When I applied CON, the output was this, which was just the same as the 9th class.

enter image description here


Finally, with help from @MichaelMiles-Stimson, the merging works. A new class 9 was added to an already classified image with 8 classes by doing this in the Raster Calculator: Con(IsNull("rip_raster"),"classif9.dat",9)

  • 2
    Do the values exist in the raster but just need to be added to the RAT? I would think that if you wanted to insert new values into an existing raster that doesn't already exist a tool like CON would be able to do that fairly easily (requires Spatial Analyst license). – Michael Stimson Sep 14 '15 at 1:01
  • Hi Michael. Thanks for the reply. The original classification is in raster format, the classes were numbered 1 to 8. Now, I would insert a new class, number 9. How can I use CON? I have not tried this tool yet. Can you guide me with it? I will appreciate any help. Thanks again. – GISnew Sep 14 '15 at 3:47
  • You can either use Con tool or Raster Calculator tool, you enter a query expression and then supply a true and false statement.. something like Con ("Original_Raster.tif" == Value, 9,Classified_Raster.tif) where Value is the number from the original raster that you want to become 9 in the classified raster. If you could include a screen shot of the original and classified rasters (with legend) I could probably be more specific. – Michael Stimson Sep 14 '15 at 3:49
  • Hi Michael. Sorry, I do not know how to attached the screenshot. Let me just put it this way: the original raster has 8 classes: Agriculture 1, Agriculture 2, Agriculture 3, Agriculture 4, Agriculture 5, Agriculture 6, Agriculture 7, Agriculture 8. I now have a raster (tif) of the new class Agriculture 9. This Agriculture 9 class will be inserted into the original raster. As I look at it, some parts of the areas of Agriculture 4, Agriculture 5, and Agriculture 6 will have to change and become Agriculture 9. Will CON solve this problem? Thanks again. – GISnew Sep 14 '15 at 4:22
1

Using Con (spatial analyst) you specify a query, in this case NewRaster == 9 and it will populate the output (new) raster where the update raster is 9 with the true value (9) and the values of the old classifed raster where it is not:

enter image description here

Or using Raster Calculator:

enter image description here

Please look at environments Cell Size and Snap Raster to help align the pixels.

  • Thanks Michael. I will try this and I will update you later. – GISnew Sep 14 '15 at 4:56
  • Hi Michael. I had a CON failed process. But i think I know what caused it. This is a very simple question. How can I change the cell value of a class in a raster attribute table? OID, Value, Count 0, 0, 38000 I want to change the 'Value ' from 0 to 2. How will I do this? Thanks. – GISnew Sep 14 '15 at 6:03
  • Use field calculator. The RAT (Raster Attribute Table) is just another table. Open in ArcMap, open the attribute table of the raster, select the row 0 and right click up the top to access field calculator, type in 2 (no quotes) and hit ok. Be careful what you do though, that does not change the value in the raster just the table that interprets it; If there already is a row with value 2 in the table you will have a duplicate entry, if the value 2 does not appear in the raster the row will now point to something else. After doing this you will need to calculate statistics to restore the count. – Michael Stimson Sep 14 '15 at 21:48
  • Did you get any error message when the Con failed? – Michael Stimson Sep 14 '15 at 21:51
  • Hi Michael. I ran CON and it failed: "An invalid SQL statement was used.An invalid SQL statement was used.Failed to execute (Con).Failed at Tue Sep 15 17:26:05 2015 (Elapsed Time: 0.10 seconds)" I wanted to attach screenshot but I wonder why each time I send my reply, gis.stackexchange.com will ask me to login. But it never logged me in! – GISnew Sep 15 '15 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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