4

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:

enter image description here

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?

4
  • Is the area of the inner ring negative while that of the outer ring is positive? Feb 10, 2012 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 Feb 10, 2012 at 15:44
  • 1
    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. Feb 10, 2012 at 16:27
  • That worked. If you add that to the Answer section, I'll check it off. Thanks Kirk. Feb 10, 2012 at 17:48

1 Answer 1

3

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.

area formula

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.