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
23 extensions .shp and .shx (or .SHP and .SHX) containing the shape data
24 and 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
52 vertice 0: 100000 7000000 (this will also be the vertice where the shape starts and ends)
53 vertice 1: 250000 6500000
54 vertice 2: 200000 6000000
55 vertice 3: 100000 7000000
56
57
58
60 0 Successful program execution.
61
62 1 Missing shp_file argument, the shapefile can´t be opened, or the
63 program ran out of memory.
64
66 The following diagnostics may be issued on stdout:
67
68 Unable to open:shp_file
69
70 Out of memory
71
73 shpadd is part of shapelib, maintained by Frank Warmerdam. This guide
74 was created by Eduardo Patoo Kanegae and converted to manpage by Johan
75 Van de Wauw.
76
78 Coordinate values that can´t be be parsed by sscanf(3) get undefined
79 values. There´s no way to give measure or Z data to vertices in a
80 shape, but those are always set to zero if the shapefile´s shape type
81 requires those values. MultiPatch shape types aren´t supported.
82
84 dbfadd(1), dbfcat(1), dbfcreate(1), dbfdump(1), dbfinfo(1), shpcat(1),
85 shpcentrd(1), shpcreate(1), shpdump(1), shpdxf(1), shpfix(1),
86 shpinfo(1), shpproj(1), shprewind(1), shptest(1)
87
88
89
90 July 2019 SHPADD(1)