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'd like to plot polygons with holes on a framework that doesn't support holes. The approach to me seems to be to translate the single polygon into several ones adding up to the whole polygon, leaving out the holes.

Is there a standard algorithm for that? Maybe even with code? Or is there another standard way to solve the problem of plotting polygons with holes?

share|improve this question

1 Answer 1

A standard way to do that is the following: If the polygon external ring is composed of n points (P1,P2,...,Pn,P1) and a hole internal ring of m points (H1,H2,...,Hm,H1), try to draw the polygon composed of the single following external ring: (P1,P2,...,Pn,P1,H1,H2,...,Hm,H1,P1). This is equivalent of drawing a fictive imperceptible corridor between the external and internal ring like there:

enter image description here

It can be generalised in case of several holes: (P1,P2,...,Pn,P1, H11,H12,...,H1m1,H21,H11, H21,H22,...,H2m2,H21, ... , P1)

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.