# ArcGIS SOAP Web Service - Determine if a Polygon Contains Negative Space

I am running queries against a polygon layer using the ArcGIS SOAP Web Service. A user selects a point within that layer and the resulting feature set contains PolygonN objects.

Occasionally, the polygons that come back contain negative space. These are also known as donut or island polygons. Here is an example:

In this case, I would only want the geometry contained in the purple area, not the green area.

When the user selects a point within the purple area, the resulting PolygonN object contains 2 rings, representing the outer and inner areas, as it should.

The inner ring, as far as I can tell, has no way to indicate that it is actually negative space. So the resulting polygon looks like it has 2 solid shapes, when in fact it is only one shape with a hole in the center.

Does anyone know how I can determine that a polygon's ring is actually negative space?

Thanks.

-
Is the area of the inner ring negative while that of the outer ring is positive? –  Kirk Kuykendall Feb 10 '12 at 15:17
The inner ring does not contain an Area attribute. From the API's perspective it is just a path where the first and last points are the same. help.arcgis.com/EN/arcgisserver/10.0/apis/soap/SOAP_Ring.htm –  Seth P. Feb 10 '12 at 15:44
Right, you'll need to use the formula at wikipedia to step through the points and compute area. A clockwise ring should have positive area while a counterclockwise has negative. Standard practice is to have negative area (counterclockwise) rings to represent interior rings. –  Kirk Kuykendall Feb 10 '12 at 16:27
That worked. If you add that to the Answer section, I'll check it off. Thanks Kirk. –  Seth P. Feb 10 '12 at 17:48

It is common practice to represent islands as counterclockwise rings with exterior rings as clockwise. If you use this formula to calculate area by stepping through the points in each ring, you should see positive area for the exterior ring, but negative area for the interior one.

-