Multipart polygon

View: New views
2 Messages — Rating Filter:   Alert me  

Multipart polygon

by Daan64 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am reading a polygon shapefile with shapelib and converting it to KML.
My polygons are multi polygons with possible holes.

The SHPObject returns a list of vertices and a list of indexes pointing to the starting vertex of each part. With the direction of the vertices (clockwise or not) I determine weather a part is a hole or not.

I am not sure about the order of the parts.

For example we have a multi polygon consisting of 2 polygons A_pol and B_pol with both a hole, respectively A_hole and B_hole.

The question is if the shapefile format guarantees that holes are always listed after the polygon they belong to. So the order would be either A_pol, A_hole, B_pol, B_hole or B_pol, B_hole, A_pol, A_hole

and not for example A_pol, B_hole, B_pol, A_hole or A_pol,  B_pol, A_hole, B_hole.
Because in the latter case I would need to check for each encountered hole to which polygon it belongs....

Thanks for any answers, Daan


Re: Multipart polygon

by murilodantas06 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Could you send me your conversor code to I study it?
I'm studing kml and i like understand the convertion from shapefile to kml file.

Thanks!!
Murilo

Daan64 wrote:
Hello,

I am reading a polygon shapefile with shapelib and converting it to KML.
My polygons are multi polygons with possible holes.

The SHPObject returns a list of vertices and a list of indexes pointing to the starting vertex of each part. With the direction of the vertices (clockwise or not) I determine weather a part is a hole or not.

I am not sure about the order of the parts.

For example we have a multi polygon consisting of 2 polygons A_pol and B_pol with both a hole, respectively A_hole and B_hole.

The question is if the shapefile format guarantees that holes are always listed after the polygon they belong to. So the order would be either A_pol, A_hole, B_pol, B_hole or B_pol, B_hole, A_pol, A_hole

and not for example A_pol, B_hole, B_pol, A_hole or A_pol,  B_pol, A_hole, B_hole.
Because in the latter case I would need to check for each encountered hole to which polygon it belongs....

Thanks for any answers, Daan