3

So much like the title says I would like to convert a 3-band infrared image TIF file of vegetation into distinct vector feature zones using ArcGIS. I'm guessing the only way to do this is with Spatial Analyst extension which is fine. The result goal would be having a feature class that would have polygon features of different vegetation levels based on the original raster image. Basically I don't want to have to hand draw my own polygon features by using the raster image as a base layer. Steps and tools involved would be appreciated.

1 Answer 1

2

The model below should get you started in the right direction. I used 4-band 1m NAIP imagery as the model input. The imagery below shows the CIR tiff on the left followed by the generalized raster in the middle and the final vector product with four vegetation zones is on the right. Unsupervised maximum likelihood classification was used on the CIR imagery. Keep in mind that you will get better results if you use supervised maximum liklihood classification, although this skill takes practice (Hint. Use the handy image classification tool bar located in Customize > Toolbars > Image Classification). In order to keep the processing to a minimum, I generalized the raster through resampling to 2 meters and ran a majority filter over the raster. Once the raster is generalized, convert to polygons and then dissolve polygons.

Run the model on a small sample of data first to work out the parameters, then add the full dataset. If you are interested in more coarse scale visualization try exporting the zones of interest to a new feature class, then aggregate and smooth the polygons. I hope this helps and best of luck!

enter image description here

enter image description here

Here's the Python code:

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")


# Local variables:
samples_tif = "C:\\gdrive\\ch1\\center_sa7\\samples.tif"
temp_tif = "C:\\gdrive\\ch1\\center_sa7\\temp.tif"
temp2 = "C:\\gdrive\\ch1\\center_sa7\\temp2"
samples_max1_tif = "C:\\gdrive\\ch1\\center_sa7\\samples_max1.tif"
Output_signature_file = ""
temp2_shp = "C:\\gdrive\\ch1\\center_sa7\\temp2.shp"
final_shp = "C:\\gdrive\\ch1\\center_sa7\\final.shp"

# Process: Iso Cluster Unsupervised Classification
arcpy.gp.IsoClusterUnsupervisedClassification_sa("C:\\gdrive\\ch1\\center_sa7\\samples.tif", "4", samples_max1_tif, "20", "10", Output_signature_file)

# Process: Resample
arcpy.Resample_management(samples_max1_tif, temp_tif, "2", "MAJORITY")

# Process: Majority Filter
arcpy.gp.MajorityFilter_sa(temp_tif, temp2, "EIGHT", "MAJORITY")

# Process: Raster to Polygon
arcpy.RasterToPolygon_conversion(temp2, temp2_shp, "SIMPLIFY", "VALUE")

# Process: Dissolve
arcpy.Dissolve_management(temp2_shp, final_shp, "GRIDCODE", "", "MULTI_PART", "DISSOLVE_LINES")
7
  • 1
    Thanks for the answer, that's helps. I was at first running into an error on the unsupervised classification about unable to open statistics file so I did some searching and saw someone with the same problem and fixed it by importing the raster into a filegdb, which worked for me too. So I have everything working but the polygons made are way too small. Any tips on getting it to avoid making such small polygons, would like smallest to be several acres in size or no lower than 1/10th the total area size of the image.
    – wilbev
    Jul 15, 2012 at 22:54
  • 1
    There's two approaches that you could take with reducing the number of polygons. For a raster based approach, up the parameters of the majority filter and/or the resampling to further generalize the raster before you convert to polygons. For a vector based approach (i.e. a more processing intensive approach) try incorporating the "Eliminate" or "Eliminate Polygon Part" (Data Management) command into the model. You could set the exclusion parameters to whatever you need. Another vector based approach would be to run the dissolve command two or three times.
    – Aaron
    Jul 16, 2012 at 1:17
  • Great, thanks for the advice. You have a been a huge help here. I'll experiment with those.
    – wilbev
    Jul 16, 2012 at 16:56
  • 1
    On the raster route, not much I can change in the Majority filter, right? Wouldn't 8 & Majority already create a biggest polygons? Or should I be running it more than once? Now on the resampling, only increasing the cell size would really increase size, right? I like the idea of Eliminate Polygon Parts tool, but I can't seem to get it to do anything. Any idea on what area units are being used, acres, square meters? I can only get the AREA option to work without a parameter error. I try any of the others and I get an error. Wish there were more examples in the help menu.
    – wilbev
    Jul 17, 2012 at 0:34
  • The eliminate command should work great for you. Make sure that you add a field in the attribute table of the new polygon feature class. Calculate geometry in the new field based on acres, for example. Once all of you polygons have an area, simply query the attributes (e.g. acres < 5). Now open the "eliminate" command and drag your polygon feature class with the selected polygons into the input layer and name the output. Make sure to select "eliminate by border" and you are good to go. Good luck!
    – Aaron
    Jul 17, 2012 at 11:56

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.

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