Select to view content in your preferred language

Help with interpreting parts and points for polygon geometry

1968
5
08-17-2011 10:13 AM
DanielWalton
Frequent Contributor
I'm not very familiar with how the GDB serializes geometries, so please excuse my noobie question. I am trying to insert a polygon feature into a GDB following the examples provided, but I'm having trouble understanding how things work for a polygon. I am specifically converting from KML, so my polygons have an outer and 0 or more inner rings, each of which is a simple point array. Can someone help me with the code I need to create these features?

Here is my code so far (C#):

Point[] oR= GetOuterRingFromKml();
List<Point[]> iRs= GetInnerRingsFromKml();
MultiPartShapeBuffer() geom = new MultiPartShapeBuffer();
geom.Setup(ShapeType.Polygon, 1 + iRs.Count(), oR.Count() + iRs.Sum(ring => ring.Count()));
//geom.Points = ??
//geom.Parts = ??
0 Kudos
5 Replies
DanielWalton
Frequent Contributor
I think I figured it out, that parts is an index to the points array marking the first point of each ring/segment.
0 Kudos
DavidSousa
Occasional Contributor
I highly recommend that you read the document describing the shape buffer, which is included in the API help system.  This is essential reading.  If you do not understand the details, the likelihood of errors is very high.
0 Kudos
DanielWalton
Frequent Contributor
Can you direct me to the most pertinent section?
0 Kudos
DavidSousa
Occasional Contributor
Go into the File Geodatabase API help system and read the following:

    Shapefile Technical Description

    Extended Shapefile Format


I can't really point you to specific parts of these documents - you need to read and understand them in their entirety.  Once you have done that, refer back to the ShapeBuffer accessor functions and I think they will make a lot more sense to you.
0 Kudos
DanielWalton
Frequent Contributor
Thanks David!
0 Kudos