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