Using ArcGIS 10, I have a Feature Class which I converted from a Raster (GRID) (Raster To Polygon Tool).

  • There are approx. 180,000 polygons.
  • The attribute table contains a [grid_code] field which I need to preserve.
  • If one or more polygons are contiguous with corners touching AND they have the same [grid_code] value, then I'd like to group them (a dissolve basically) into one polygon (record).
  • Then I need to calculate the grouped polygon's area.

Using the Select By Location Tool, I'm able to successfully select the polygons that I need to group, but how do I then convert them into ONE polygon, while preserving the [grid_code] ?

  • 3
    Have you considered running the Region Group command before converting the rasters to polygons? Commented Jan 17, 2012 at 22:54
  • 1
    Kirk is absolutely right: you want to do this calculation with the original grid, where it will be quick and efficient, rather than in the output vector format, where it will be slow and painful.
    – whuber
    Commented Jan 17, 2012 at 23:12
  • 2
    Thank you Kirk and Bill. Yes, Region Group is the right tool. Unfortunately, using Region Group on my large dataset causes horizontal striping, a known Spatial Analyst error. These stripes have been documented as early as Dec. 2009, but now, using ArcGIS 10, these problems STILL exist. You can read all about it here: [link]( forums.arcgis.com/threads/… ) My work around is to write the output from the Region Group tool to a good old fashioned ArcInfo Workspace as a GRID. That seems to fix it!
    – mjn
    Commented Jan 18, 2012 at 21:20
  • Without that work-around, and given the RegionGroup bug, you would have to perform a 2x2 focal variety calculation to identify potential corners (the variety has to be 3 or 4) and then use those to create a table of potential corner-to-corner relationships among the polygons, which could (greatly) streamline the search for corner-touching polygons. What a pain...
    – whuber
    Commented Jan 19, 2012 at 19:27
  • Keep in mind that if the polygons share only a single vertex, you introduce a self-intersection and thereby invalidate the geometry.
    – Jim B
    Commented Mar 30, 2012 at 19:05

3 Answers 3


You can dissolve contiguous polygons with common id values by using the Dissolve Tool.

  1. Select your Grid code field as your "Dissolve_Field (optional)"
  2. At the bottom of the tool form, check the "Unsplit lines (optional)" checkbox.
  3. Create area field
  4. Right click area field and select Calculate Geometry

That is a lot of polygons. I would also find a solution in raster format first when the topology is easier to handle. But if you don't want to write code, you could :

  1. Select a given grid code.
  2. buffer that grid code by a very small amount (merged buffers option)
  3. buffer the result negatively by the same very small about.

There will be a slight rounding in the geometry.

To create a single layer, intersect the resulting grid code layers and clean to remove sliver polygons.


I would, personally, write code that looped through the polygons, and checked on the 4 corner coords of a polygon being the same as any other polygon corners and recursively call it - Flood fill as such.

I do this with netCDF grids to create appropriately similar polygons.

Another option would be to progamatically do this at root with the grid.

  • Comments have been purged when they have degraded into pointless bickering and / or noise, and the entire set is unsalvageable.
    – Mapperz
    Commented Jan 20, 2012 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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