SHPADD(1)

✨ SHPADD(1) ✨

okay bestie, welcome to shpadd from shplib β€” she's the girl who appends a shape to an ESRI shapefile and she does it flawlessly πŸ’…


🌸 NAME 🌸

shpadd β€” append a shape to an ESRI shapefile


πŸŽ€ SYNOPSIS πŸŽ€

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

πŸ’– DESCRIPTION πŸ’–

So basically, shpadd appends a shape to the shapefile that it figures out from shp_file ✨

The geometric data of your brand-new shape is made of lists of X/Y points that you drop right there on the command line, grouped into parts β€” and points that live in different parts get separated by a plus sign (+). Iconic, honestly.

If you give her no points and no parts at all? Then a shape of type NullShape gets appended to the shapefile. Otherwise the type of the new shape is decided by the shapefile's header, no cap. Peep shpdump(1) for a rundown of shape types and how geometric data for parts gets interpreted for any specific type πŸ‘‘

Heads up bestie: shpadd(1) does NOT enforce any of the geometric restrictions set by the shapefile specification. Like, none. Zero. She trusts you. 🫢

Shapefiles are actually two files β€” same basename, extensions .shp and .shx (or .SHP and .SHX) β€” holding the shape data and the shape index respectively πŸ’« The files to open get determined by first stripping any filename extension off of file, then attempting to open shp_file.shp or shp_file.SHP, and shp_file.shx or shp_file.SHX, for the respective data and index files. It's giving two peas in a pod πŸ“


🌈 OPTIONS 🌈

  • shp_file β€” the name of an existing shapefile, bestie. She has to already be there.
  • x1 y1 x2 y2 ... xn yn β€” the set of x,y coordinates that describes the shape you wish to add πŸ’•
Real talk: you must specify the correct number of parameters for a given type of shapefile. For example: 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, periodt πŸ”Ί) 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 πŸŽ‰ she ate, no crumbs.
  • 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. Yeah. Undefined. Be careful out there bestie 🚨
  • 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. Not today, not ever πŸ’”

πŸ”₯ SEE ALSO πŸ”₯

dbfadd(1), dbfcat(1), dbfcreate(1), dbfdump(1), dbfinfo(1), shpcat(1), shpcentrd(1), shpcreate(1), shpdump(1), shpdxf(1), shpfix(1), shpinfo(1), shpproj(1), shprewind(1), shptest(1)


March 2026 β€” that's the date, and this lil legend lives in shplib, filed under SHPADD(1) πŸ’œ mwah, go add some shapes bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from