Point
A point consists of a pair of double-precision coordinates in the order x, y.
Point Byte Stream Contents
Byte 0 |
Shape Type |
1 |
Integer |
1 |
Little |
Byte 4 |
X |
X |
Double |
1 |
Little |
Byte 12 |
Y |
Y |
Double |
1 |
Little |
MultiPoint
A MultiPoint consists of a collection of points. The bounding box is stored in the order Xmin, Ymin, Xmax, Ymax.
MultiPoint Byte Stream Contents
Byte 0 |
Shape Type |
8 |
Integer |
1 |
Little |
Byte 4 |
Box |
Box |
Double |
4 |
Little |
Byte 36 |
NumPoints |
NumPoints |
Integer |
1 |
Little |
Byte 40 |
Points |
Points |
Points |
NumPoints |
Little |
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 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 fields for a PolyLine are described in detail below:
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 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. |
PolyLine Byte Stream Contents
Byte 0 |
Shape Type |
3 |
Integer |
1 |
Little |
Byte 4 |
Box |
Box |
Double |
4 |
Little |
Byte 36 |
NumParts |
NumParts |
Integer |
1 |
Little |
Byte 40 |
NumPoints |
NumPoints |
Integer |
1 |
Little |
Byte 44 |
Parts |
Parts |
Integer |
NumParts |
Little |
Byte X |
Points |
Points |
Point |
NumPoints |
Little |
Note
X = 44 + 4 * NumParts |
Polygon
A polygon consists of one or more rings. A ring is a connected sequence
of four or more points that form a closed, nonself-intersecting loop.
A polygon may contain multiple outer rings. The order of vertices or orientation
for a ring indicates which side of the ring is the interior of the polygon.
The neighborhood to the right of an observer walking along the ring in
vertex order is the neighborhood inside the polygon. Vertices of rings
defining holes in polygons are in a counterclockwise direction. Vertices
for a single, ringed polygon are, therefore, always in clockwise order.
The rings of a polygon are referred to as its parts.
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 or zero area parts that might result are not
allowed.
The fields for a polygon are described in detail below:
Box: |
The bounding
box for the Polygon stored in the order Xmin, Ymin, Xmax, Ymax. |
NumParts |
The number of rings in the Polygon. |
NumPoints |
The total number of points for all rings |
Parts |
An array of length NumParts. Stores, for each ring, the index of its
first point in the points array. Array indexes are with respect to 0. |
Points |
An array of length NumPoints. The points for each ring in the polygon
are stored end to end. The points for ring 2 follow the points for ring
1, and so on. The parts array holds the array index of the starting point
for each ring. There is no delimiter in the points array between rings. |
The following are important notes about polygon shapes.
The rings are closed (the first and last vertex
of a ring must be the same).
The order of rings in the points array is not
significant.
Polygons stored in a shapefile must be clean.
A clean polygon is one that has no self-intersections.
This means that a segment belonging to one ring may not intersect a segment
belonging to another ring. The rings of a polygon can touch each other
at vertices but not along segments. Colinear segments are considered intersecting.
A clean polygon is one that has the inside of
the polygon on the correct side of the line that defines it. The neighborhood
to the right of an observer walking along the ring in vertex order is
the inside of the polygon. Vertices for a single, ringed polygon are,
therefore, always in clockwise order. Rings defining holes in these polygons
have a counterclockwise orientation. Dirty polygons occur when the rings
that define holes in the polygon also go clockwise, which causes overlapping
interiors.
A sample polygon instance
This figure shows a polygon with one hole and a total of eight vertices.
For this example, NumParts equals 2 and NumPoints equals 10. Note that the order
of the points for the donut (hole) polygon is reversed below.

For this example, NumParts equals 2 and NumPoints equals 10. Note that the
order of the points for the donut (hole) polygon is reversed below.

Polygon Byte Stream Contents
|