shpadd(1) append a shape to an ESRI shapefile

SYNOPSIS

shpadd shp_file [[x y] [+]]*

DESCRIPTION

Appends a shape to the shapefile determined from shp_file. The geometric data of the new shape consists of lists of X/Y points on the command line grouped into parts, with points in different parts separated by a plus (+) sign. If no points or parts are given then a shape of type NullShape is appended to the shapefile, and otherwise the type of the new shape is determined by the shapefile's header. See shpdump(1) for a description of shape types and how geometric data for parts are interpreted for a specific type. No geometric restrictions set by the shapefile specification are enforced by shpadd(1).

Shapefiles actually consist of two files with the same basename and extensions .shp and .shx (or .SHP and .SHX) containing the shape data and shape index respectively. The files to open are determined by first stripping any filename extension from file and attempting to open the files shp_file.shp or shp_file.SHP, and shp_file.shx or shp_file.SHX for the respective data and index files.

OPTIONS

shp_file
the name of an existing shapefile.
x1 y1 x2 y2 ... xn yn
the set of x,y coordinates that describes the shape that you wish to add. Note that you must specify the correct number of parameters for a given type of shapefile. e.g.: for point shapefiles you have to pass 1 pair of XY coordinates and for a polygon shapefile you should pass at least 4 pairs of XY coordinates (where the first and the last point must have the same coordinates).

EXAMPLE

shpadd testpolygon 100000 7000000 250000 6500000 200000 6000000 100000 7000000

assuming that testpolygon is a polygon shapefile, this command line will insert a new shape (a triangle) into testpolygon with the following XY coordinates:

vertice 0: 100000 7000000 (this will also be the vertice where the shape starts and ends)
vertice 1: 250000 6500000
vertice 2: 200000 6000000
vertice 3: 100000 7000000

EXIT STATUS

0
Successful program execution.
1
Missing shp_file argument, the shapefile can't be opened, or the program ran out of memory.

DIAGNOSTICS

The following diagnostics may be issued on stdout:

Unable to open:shp_file

Out of memory

AUTHOR

shpadd is part of shapelib, maintained by Frank Warmerdam. This guide was created by Eduardo Patoo Kanegae and converted to manpage by Johan Van de Wauw.

BUGS

Coordinate values that can't be be parsed by sscanf(3) get undefined values. There's no way to give measure or Z data to vertices in a shape, but those are always set to zero if the shapefile's shape type requires those values. MultiPatch shape types aren't supported.