PolyLine

A PolyLine is an ordered set of vertices that consists of one or more parts. A part is a connected sequence of two or more points. Parts may be connected to and may intersect one another.

Because this specification does not forbid consecutive points with identical coordinates, shapefile readers must handle such cases. On the other hand, the degenerate zero length parts that might result are not allowed.

The following fields are for a PolyLine:
Box
The bounding box for the PolyLine, stored in the order Xmin, Ymin, Xmax, Ymax
NumParts
The number of parts in the PolyLine
NumPoints
The total number of points for all parts
Parts
An array of length NumParts. Stores, for each PolyLine, the index of its first point in the points array

Array indexes are numbered with respect to 0.

Points
An array of length NumPoints

The points for each part in the PolyLine are stored end to end. The points for part 2 follow the points for part 1, and so on. The parts array holds the array index of the starting point for each part. There is no delimiter in the points array between parts.

The following table shows PolyLine byte stream contents.
Position Field Value Type Number Byte order
Byte 0 Shape Type 3 Integer 1 Little endian
Byte 4 Box Box Double 4 Little endian
Byte 36 NumParts NumParts Integer 1 Little endian
Byte 40 NumPoints NumPoints Integer 1 Little endian
Byte 44 Parts Parts Integer NumParts Little endian
Byte X Points Points Point NumPoints Little endian
Tip: X = 44 + (4 * NumParts)