Take the 2-minute tour ×

Is it possible to return the boundary (outside) permiter of a polygon layer?

Let's say you have the map of the USA, for simplicity, broken down to the county level, is it possible to return the boundary map of the whole country from that map?

share|improve this question
So in the example case of the US, you mean actually get the outline of the states, NOT the bounding box, right? If so, how about a dissolve of the counties layer? –  Chad Cooper Nov 19 '10 at 18:47
@Chad Cooper - when I dissolve the layer, i still get some lines showing up for counties and states. –  dassouki Nov 19 '10 at 20:18

7 Answers 7

up vote 5 down vote accepted

You can just do a dissolve on the county layer (be sure to have just the counties you want to dissolve selected).

share|improve this answer
I'm getting some internal lines still showing up in dissolve. –  dassouki Nov 19 '10 at 20:13
Can you buffer twice to eliminate the internal lines? Out, to "eat" the lines, then back in, to restore the original size. –  mwalker Nov 19 '10 at 20:50
for some reason this worked. I know it's the "hackiest" of solutions, but this was the only solution that got rid of the lines –  dassouki Nov 22 '10 at 14:13
+1 This actually is a great solution. It works by accommodating tiny slivers and overlaps in the component polygons (and also overcomes many inherent bugs in the software, too). –  whuber Nov 22 '10 at 20:09
I used mwalker's advice to buffer out then in. I hope you can include that in your answer. –  dassouki Nov 22 '10 at 20:15

You can use GRASS module: v.dissolve You only need to import your data into GRASS. Here is a screen-cast of transferring your data to Grass from inside QGis.

share|improve this answer

Allow me to plug my own project... Boundary Generator will give you both external and internal boundaries of every polygon (as line features).

Internal boundaries are attributed with the FID for each of the two polygons that share that border. External boundaries should have an FID of zero for one of those two, so they are easy to select out of the full result.

The nice thing about it vs doing dissolves is that I've added a couple of knobs over precision so it can deal with not-quite-perfect data. (How far apart should two polygon borders be to be considered a shared border? How much angle deviation is required?)

It's still in alpha and it's been a while since I've tackled an update; I'd love to hear how well it works for you!

share|improve this answer
 public static IPolygon getPolygonFromLayer(ILayer layer)
            IFeatureLayer FLayer = layer as IFeatureLayer;
            IFeatureClass FClass = FLayer.FeatureClass;
            return polygonMerge(FClass);

   private static IPolygon polygonMerge(IFeatureClass featureClass)
            if (featureClass == null) return null;
            IGeoDataset geoDataset = featureClass as IGeoDataset;

            //You can use a spatial filter to create a subset of features to union together. 
            //To do that, uncomment the next line, and set the properties of the spatial filter here.
            //Also, change the first parameter in the IFeatureCursor.Seach method.
            //ISpatialFilter queryFilter = new SpatialFilterClass();

            IGeometry geometryBag = new GeometryBagClass();

            //Define the spatial reference of the bag before adding geometries to it.
            geometryBag.SpatialReference = geoDataset.SpatialReference;

            //Use a nonrecycling cursor so each returned geometry is a separate object. 
            IFeatureCursor featureCursor = featureClass.Search(null, false);

            IGeometryCollection geometryCollection = geometryBag as IGeometryCollection;
            IFeature currentFeature = featureCursor.NextFeature();

            while (currentFeature != null)
                //Add a reference to this feature's geometry to the bag.
                //Since you don't specify the before or after geometry (missing),
                //the currentFeature.Shape IGeometry is added to the end of the geometryCollection.
                object missing = Type.Missing;
                geometryCollection.AddGeometry(currentFeature.Shape, ref missing, ref missing);
                currentFeature = featureCursor.NextFeature();

            // Create the polygon that will be the union of the features returned from the search cursor.
            // The spatial reference of this feature does not need to be set ahead of time. The 
            // ConstructUnion method defines the constructed polygon's spatial reference to be the 
            // same as the input geometry bag.
            ITopologicalOperator unionedPolygon = new PolygonClass();
            unionedPolygon.ConstructUnion(geometryBag as IEnumGeometry);

            return unionedPolygon as IPolygon;

share|improve this answer

Your getting lines when you do a dissolve because the boundaries are not seamless.

Regardless of software product, do the following:

Do an integrate. alt text

Then do a dissolve. alt text

share|improve this answer
I tried this several times, and it didn't work :(, I keep losing some polygons, I used a very small tolerance and a very large one as well –  dassouki Nov 22 '10 at 14:12

It sounds like the Bounding Containers sample posted on arcgis.com will work for what you want.

share|improve this answer
This is a good thought, but that solution is unlikely to work in this fasion. It is intended to provide additional geometric information about features by finding the smallest member of a class of shapes that contains the features, such as a rectangle, circle, ellipse, or convex polygon. The result is always one of those containing shapes. In general it will not coincide exactly with the original shape unless that boundary already has the desired shape. –  whuber Nov 22 '10 at 20:06

You may also be looking for what used to be called DROPLINE functionality.

Although it did not survive the ArcInfo Workstation to ArcGIS Desktop transition, there is currently an ArcGIS Idea to have it restored:

It would be nice to have the option to drop the lines between polygons that have the same values for a specified field. This functionality used to be available in ArcPlot as the DROPLINE command and was widely used as a way to avoid creating a new dataset with the dissolve command.

share|improve this answer

Your Answer


