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.

Actually, this is a continuation of a previous post entitled "Count the number of corners of a polygon". Although I managed to count the number of points (i.e. saying corners) of each polygon the problem is that even a polygon may be approximately rectangular actually has more than four points because of the digitization process i.e. sometimes an approximate straight line consists of more than 2 points. How can I ignore the intermediate additional points that are not really needed for my purpose? Thanks.

share|improve this question
1  
Did you try casting the polygon as an IPolycurve and calling Generalize? –  Kirk Kuykendall Jun 9 '11 at 13:12
    
You could check the angles formed at each point; if greater than a certain threshold, don't count that point. –  Michael Todd Jun 9 '11 at 16:44
    
Actually, I have already thought to do that but my new problem is that some angles are measured based on the exterior turn and not the interior of the polygon. For example, while actually an angle is 90 degrees I got 270 degrees. The thing is that I dont not know why this happens and which angles for each polygon have this mistake. I try to compare some polygons using a CAD system. Do you have an idea about this problem? –  Demetris Jun 9 '11 at 19:13
1  
@Demetris, 90 degrees and 270 degrees both look the same, it depends if you measure clockwise or counter-clockwise. For the threshold you'll want to compare to 180 degrees to determine if you want to ignore. bool ignore = Math.abs(angle - 180) > threshold –  Chris Aug 25 '11 at 12:16

2 Answers 2

I would simplify the polygon first to remove any of the unwanted vertices.

share|improve this answer
    
It is not a good idea to remove vertices because you may considerably modify the real shape of the polygon. –  Demetris Jun 14 '11 at 12:43
    
Demetris; the OP is actually asking to simplify the features, just not using those words. Using a suitable algorithm, you should be able to maintain the overall shape fairly well. –  Darren Cope Jun 24 '11 at 11:48
1  
(+1) @Demetris This is a good, simple solution. The vertices that remain in the simplified polygon will be exactly the ones you want to count. You have the flexibility to use any simplification routine you like (and many of them let you set a tolerance), allowing you to achieve the results you intend. Of course you don't replace the original polygon with the simplified one--the simplification is done on-the-fly purely for the purposes of obtaining the vertex count, and then is abandoned. –  whuber Sep 28 '11 at 15:26

Go through each vertex and for each that is outside of tolerance of 180 degrees include in the count?

share|improve this answer

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.