Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Thanks.

share|improve this question
    
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
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. –  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
add comment

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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