1SHPADD(1) shapelib SHPADD(1)
2
3
4
6 shpadd - append a shape to an ESRI shapefile
7
9 shpadd shp_file [[x y] [+]]*
10
12 Appends a shape to the shapefile determined from shp_file. The geomet‐
13 ric data of the new shape consists of lists of X/Y points on the com‐
14 mand line grouped into parts, with points in different parts separated
15 by a plus (+) sign. If no points or parts are given then a shape of
16 type NullShape is appended to the shapefile, and otherwise the type of
17 the new shape is determined by the shapefile´s header. See shpdump(1)
18 for a description of shape types and how geometric data for parts are
19 interpreted for a specific type. No geometric restrictions set by the
20 shapefile specification are enforced by shpadd(1).
21
22 Shapefiles actually consist of two files with the same basename and ex‐
23 tensions .shp and .shx (or .SHP and .SHX) containing the shape data and
24 shape index respectively. The files to open are determined by first
25 stripping any filename extension from file and attempting to open the
26 files shp_file.shp or shp_file.SHP, and shp_file.shx or shp_file.SHX
27 for the respective data and index files.
28
30 shp_file
31 the name of an existing shapefile.
32
33 x1 y1 x2 y2 ... xn yn
34 the set of x,y coordinates that describes the shape that you
35 wish to add. Note that you must specify the correct number of
36 parameters for a given type of shapefile. e.g.: for point shape‐
37 files you have to pass 1 pair of XY coordinates and for a poly‐
38 gon shapefile you should pass at least 4 pairs of XY coordinates
39 (where the first and the last point must have the same coordi‐
40 nates).
41
43 shpadd testpolygon 100000 7000000 250000 6500000 200000 6000000 100000
44 7000000
45
46 assuming that testpolygon is a polygon shapefile, this command line
47 will insert a new shape (a triangle) into testpolygon with the follow‐
48 ing XY coordinates:
49
50
51 vertice 0: 100000 7000000 (this will also be the vertice where the shape starts and ends)
52 vertice 1: 250000 6500000
53 vertice 2: 200000 6000000
54 vertice 3: 100000 7000000
55
56
57
59 0 Successful program execution.
60
61 1 Missing shp_file argument, the shapefile can´t be opened, or the
62 program ran out of memory.
63
65 The following diagnostics may be issued on stdout:
66
67 Unable to open:shp_file
68
69 Out of memory
70
72 shpadd is part of shapelib, maintained by Frank Warmerdam. This guide
73 was created by Eduardo Patoo Kanegae and converted to manpage by Johan
74 Van de Wauw.
75
77 Coordinate values that can´t be be parsed by sscanf(3) get undefined
78 values. There´s no way to give measure or Z data to vertices in a
79 shape, but those are always set to zero if the shapefile´s shape type
80 requires those values. MultiPatch shape types aren´t supported.
81
83 dbfadd(1), dbfcat(1), dbfcreate(1), dbfdump(1), dbfinfo(1), shpcat(1),
84 shpcentrd(1), shpcreate(1), shpdump(1), shpdxf(1), shpfix(1), sh‐
85 pinfo(1), shpproj(1), shprewind(1), shptest(1)
86
87
88
89 July 2023 SHPADD(1)