1SHPDUMP(1) shapelib SHPDUMP(1)
2
3
4
6 shpdump - dumps as text and/or validates the content of an ESRI shape‐
7 file
8
10 shpdump [-validate] shp_file
11
13 Prints the contents of the shapefile shp_file to standard output in
14 textual format. Shapefiles actually consist of two files with the same
15 basename and extensions .shp and .shx (or .SHP and .SHX) containing the
16 shape data and shape index respectively. The files to open are deter‐
17 mined by first stripping any filename extension from shp_file and at‐
18 tempting to open the files shp_file.shp or shp_file.SHP, and
19 shp_file.shx or shp_file.SHX for the respective data and index files.
20
21 Output consists of a header giving number and type of shapes in the
22 file and the bounds for the minimum and maximum X, Y, Z, and M values
23 appearing in the shapes. The header is followed by the geometric data
24 for each shape in the file. All shapes in the file should be of the
25 same type, except that NullShape typed shapes may be intermixed with
26 any other type. The header has the form
27
28
29 Shapefile Type: type # of Shapes: count
30
31 File Bounds: (minX,minY,minZ,minM)
32 to (maxX,maxY,maxZ,maxM)
33
34
35
36 See section SHAPE TYPES below for the list of possible shape types.
37
38 Next for each shape in the file a header giving it´s shape_index, it´s
39 type type, number of vertices nVertices, number of parts nParts, and
40 bounding box is given, followed by the vertex data of each part.
41
42
43 Shape: shape_index (type) nVertices=nVertices, nParts=nParts
44 Bounds: (minX,minY,minZ,minM)
45 to (maxX,maxY,maxZ,maxM)
46
47 vertices of the first part
48
49 + vertices of the second part...
50
51 + vertices of the last part
52
53
54
55 The shape_index of a shape is the number of the shape starting from
56 zero in the shape file. Each vertex has the form
57
58
59 (X,Y,Z,M)
60
61
62
63 If there are multiple parts then the type of the part is appended ap‐
64 pended to first vertex of each part, and the first vertex of the second
65 and following parts is preceded by a plus (+) sign. The part type is
66 Ring for all shape types except MultiPatch where it is the type of a
67 surface patch. See below for the description of possible part types.
68
70 Each type of shape except MultiPatch typed shapes comes in three
71 flavours: The normal unsuffixed type, where points lie in X/Y-space; a
72 type with suffix M where points lie in X/Y-space and additionally have
73 a measure value in M-space; and finally a type with suffix Z where
74 points lie in X/Y/Z-space and also have a measure value in M-space.
75
76 NullShape
77 A shape without data. Shapes of this type may be intermixed with
78 other shapes and are sometimes used to represented deleted or
79 missing geometric data for a shape.
80
81 Point or PointZ or PointM
82 A single point.
83
84 Arc or ArcZ or ArcM
85 Piecewise linear paths. Shapes of this type may consist of mul‐
86 tiple parts which may or may not intersect and/or connect. Arcs
87 are called PolyLines in the shapefile specification.
88
89 Polygon or PolygonZ or PolygonM
90 Polygon shapes consist of one or more parts, called rings, that
91 each define a closed path. Rings must contain at least four ver‐
92 tices with the first and last vertices being equal, and must not
93 self-intersect. For shapes of type Polygon, the rings define a
94 polygon with optional holes by giving the vertices of inner
95 rings a counterclockwise orientation and the vertices of outer
96 rings a clockwise orientation. Intersection and orientation is
97 always computed in X/Y-space and never in X/Y/M-space.
98
99 MultiPoint or MultiPointZ or MultiPointM
100 A set of points.
101
102 MultiPatch
103 A MultiPatch represents one or more surfaces in X/Y/Z-space, and
104 consists of a number of parts called it´s surface patches. Each
105 surface patch describes a either a surface or a hole in another
106 surface, depending on the type of the patch. Patches may share a
107 common boundary but may not otherwise intersect. The type of a
108 patch may be one of
109
110 TriangleStrip: A set of connected triangles. The first three
111 points define the first triangle and every following point de‐
112 fines a new triangle using the new point and the two previous
113 points.
114
115 TriangleFan: A set of connected triangles. The first three
116 points define the first triangle and every following point de‐
117 fines a new triangle using the previous point, the current
118 point, and the first point, thus forming a fan of triangles
119 around the first point.
120
121 OuterRing: The outer ring of a sequence of rings defining a
122 polygon with holes. All following parts of type InnerRing are
123 taken to be the holes of the polygon. The sequence of rings ends
124 with the first non-InnerRing typed part or the part of the
125 shape, whichever comes first.
126
127 InnerRing: An inner ring in a sequence of rings defining a poly‐
128 gon with holes. This type of part may only follow an OuterRing
129 or other InnerRing typed parts.
130
131 FirstRing: The first in a sequence of rings defining a polygon
132 of unspecified type. The following parts of type Ring defines
133 the other rings in the polygon. This type of part is used when
134 the innerness or outerness of a polygon isn´t known or applica‐
135 ble. The sequence of rings defining the polygon ends with the
136 first non-Ring typed part or the last part of the shape, which‐
137 ever comes first.
138
139 Ring: A ring in a sequence of rings defining a polygon of un‐
140 specified type. It may only follow a FirstRing or other Ring
141 typed parts.
142
143 UknownPartType: This type is returned for parts whose type isn´t
144 recognised.
145
146 UnknownShapeType
147 This type is returned for shapes whose type isn´t recognised.
148
150 -validate
151 count the number of objects that have invalid ring ordenings
152
153 Performs validation on the orientation of inner and outer rings
154 in Polygon, PolygonZ, and PolygonM objects. According to the
155 shapefile specification outer rings should be given a clockwise
156 orientation, and inner rings that define holes a counterclock‐
157 wise orientation. If some rings of a shape are oriented the
158 wrong way around then the following message is output after
159 dumping that shape:
160
161 count rings wound in the wrong direction.
162
163 In addition the total number of shapes with problem rings is
164 output after the last shape has been dumped:
165
166 count object has invalid ring orderings.
167
168 shp_file
169 the name of an existing shapefile.
170
172 0 Successful program execution.
173
174 1 No shapefile shp_file was given or it couldn´t be opened.
175
177 $ shpdump shapefile.shp
178
179 Shapefile Type: Arc # of Shapes: 3
180
181 File Bounds: ( 3531586.750, 7253086.100,0,0)
182 to ( 3536417.463, 7778375.875,0,0)
183
184 Shape:0 (Arc) nVertices=2, nParts=1
185 Bounds:( 3536397.797, 7253086.100, 0, 0)
186 to ( 3536417.463, 7253163.597, 0, 0)
187 ( 3536397.797, 7253163.597, 0, 0) Ring
188 ( 3536417.463, 7253086.100, 0, 0)
189
190 Shape:1 (Arc) nVertices=3, nParts=1
191 Bounds:( 3458966.390, 7373335.808, 0, 0)
192 to ( 3459141.856, 7373474.681, 0, 0)
193 ( 3458966.390, 7373474.681, 0, 0) Ring
194 ( 3458979.042, 7373466.273, 0, 0)
195 ( 3459141.856, 7373335.808, 0, 0)
196
197 Shape:2 (Arc) nVertices=7, nParts=1
198 Bounds:( 3531586.750, 7777880.500, 0, 0)
199 to ( 3532930.206, 7778375.875, 0, 0)
200 ( 3531586.750, 7777880.500, 0, 0) Ring
201 ( 3532228.265, 7778072.455, 0, 0)
202 ( 3532310.897, 7778119.445, 0, 0)
203 ( 3532367.866, 7778144.877, 0, 0)
204 ( 3532440.559, 7778168.920, 0, 0)
205 ( 3532506.504, 7778190.785, 0, 0)
206 ( 3532930.206, 7778375.875, 0, 0)
207
208 $
209
211 The following diagnostics may be issued on stdout:
212
213 Unable to open:shp_file
214
216 shpdump is part of shapelib, maintained by Frank Warmerdam. This guide
217 was created by Eduardo Patoo Kanegae and converted to manpage by Johan
218 Van de Wauw. It was further enhanced with the man page written by
219 Joonas Pihlaja (jpihlaja@cc.helsinki.fi).
220
222 The -validate option supports only one outer ring in a polygonal shape
223 and assumes that the first ring in a shape is the outer ring. It
224 doesn´t support polygons inside MultiPatch shapes. The X and Y coordi‐
225 nates of a point are printed to three decimal places only.
226
228 dbfadd(1), dbfcat(1), dbfcreate(1), dbfdump(1), dbfinfo(1), shpadd(1),
229 shpcat(1), shpcentrd(1), shpcreate(1), shpdxf(1), shpfix(1), sh‐
230 pinfo(1), shpproj(1), shprewind(1), shptest(1)
231
232
233
234 July 2023 SHPDUMP(1)