--- shapelib-1.2.10.orig/contrib/Makefile +++ shapelib-1.2.10/contrib/Makefile @@ -9,7 +9,7 @@ SHPOBJ = ../shpopen.o ../dbfopen.o -SHPGOBJ = ../shpopen.o ../dbfopen.o shpgeo.o +SHPGOBJ = ../shpopen.o ../dbfopen.o shpgeo.o GEOOBJ = ./shpgeo.o -lm -lproj --- shapelib-1.2.10.orig/contrib/shpgeo.h +++ shapelib-1.2.10/contrib/shpgeo.h @@ -67,7 +67,7 @@ extern "C" { #endif -#include "proj_api.h" +## #include "proj_api.h" #define SHPD_POINT 1 --- shapelib-1.2.10.orig/dbfopen.c +++ shapelib-1.2.10/dbfopen.c @@ -197,8 +197,6 @@ # define TRUE 1 #endif -static int nStringFieldLen = 0; -static char * pszStringField = NULL; /************************************************************************/ /* SfRealloc() */ @@ -431,6 +429,12 @@ psDBF->panFieldOffset[iField-1] + psDBF->panFieldSize[iField-1]; } +/* -------------------------------------------------------------------- */ +/* Initialize our temporary input fields. */ +/* -------------------------------------------------------------------- */ + psDBF->nStringFieldLen = 0; + psDBF->pszStringField = NULL; + return( psDBF ); } @@ -489,14 +493,12 @@ free( psDBF->pszHeader ); free( psDBF->pszCurrentRecord ); - free( psDBF ); - - if( pszStringField != NULL ) + if( psDBF->pszStringField != NULL ) { - free( pszStringField ); - pszStringField = NULL; - nStringFieldLen = 0; + free( psDBF->pszStringField ); } + + free( psDBF ); } /************************************************************************/ @@ -571,6 +573,12 @@ psDBF->bNoHeader = TRUE; +/* --------------------------------------------------------------------*/ +/* Initialize our temporary input fields.*/ +/* --------------------------------------------------------------------*/ + psDBF->nStringFieldLen = 0; + psDBF->pszStringField = NULL; + return( psDBF ); } @@ -691,7 +699,6 @@ unsigned char *pabyRec; void *pReturnField = NULL; - static double dDoubleField; /* -------------------------------------------------------------------- */ /* Verify selection. */ @@ -734,30 +741,31 @@ /* -------------------------------------------------------------------- */ /* Ensure our field buffer is large enough to hold this buffer. */ /* -------------------------------------------------------------------- */ - if( psDBF->panFieldSize[iField]+1 > nStringFieldLen ) + if( psDBF->panFieldSize[iField]+1 > psDBF->nStringFieldLen ) { - nStringFieldLen = psDBF->panFieldSize[iField]*2 + 10; - pszStringField = (char *) SfRealloc(pszStringField,nStringFieldLen); + psDBF->nStringFieldLen = psDBF->panFieldSize[iField]*2 + 10; + psDBF->pszStringField = (char *) SfRealloc(psDBF->pszStringField, + psDBF->nStringFieldLen); } /* -------------------------------------------------------------------- */ /* Extract the requested field. */ /* -------------------------------------------------------------------- */ - strncpy( pszStringField, + strncpy( psDBF->pszStringField, ((const char *) pabyRec) + psDBF->panFieldOffset[iField], psDBF->panFieldSize[iField] ); - pszStringField[psDBF->panFieldSize[iField]] = '\0'; + psDBF->pszStringField[psDBF->panFieldSize[iField]] = '\0'; - pReturnField = pszStringField; + pReturnField = psDBF->pszStringField; /* -------------------------------------------------------------------- */ /* Decode the field. */ /* -------------------------------------------------------------------- */ if( chReqType == 'N' ) { - dDoubleField = atof(pszStringField); + psDBF->dDoubleField = atof(psDBF->pszStringField); - pReturnField = &dDoubleField; + pReturnField = &psDBF->dDoubleField; } /* -------------------------------------------------------------------- */ @@ -768,7 +776,7 @@ { char *pchSrc, *pchDst; - pchDst = pchSrc = pszStringField; + pchDst = pchSrc = psDBF->pszStringField; while( *pchSrc == ' ' ) pchSrc++; @@ -776,7 +784,7 @@ *(pchDst++) = *(pchSrc++); *pchDst = '\0'; - while( pchDst != pszStringField && *(--pchDst) == ' ' ) + while( pchDst != psDBF->pszStringField && *(--pchDst) == ' ' ) *pchDst = '\0'; } #endif @@ -1351,9 +1359,6 @@ { int nRecordOffset; unsigned char *pabyRec; - static char *pReturnTuple = NULL; - - static int nTupleLen = 0; /* -------------------------------------------------------------------- */ /* Have we read the record? */ @@ -1375,14 +1380,15 @@ pabyRec = (unsigned char *) psDBF->pszCurrentRecord; - if ( nTupleLen < psDBF->nRecordLength) { - nTupleLen = psDBF->nRecordLength; - pReturnTuple = (char *) SfRealloc(pReturnTuple, psDBF->nRecordLength); + if ( psDBF->nStringFieldLen < psDBF->nRecordLength) { + psDBF->nStringFieldLen = psDBF->nRecordLength; + psDBF->pszStringField = (char *) SfRealloc(psDBF->pszStringField, + psDBF->nRecordLength); } - memcpy ( pReturnTuple, pabyRec, psDBF->nRecordLength ); + memcpy ( psDBF->pszStringField, pabyRec, psDBF->nRecordLength ); - return( pReturnTuple ); + return( psDBF->pszStringField ); } /************************************************************************/ --- shapelib-1.2.10.orig/shapefil.h +++ shapelib-1.2.10/shapefil.h @@ -401,6 +401,11 @@ int bNoHeader; int bUpdated; + + int nStringFieldLen; + char *pszStringField; + + double dDoubleField; } DBFInfo; typedef DBFInfo * DBFHandle; --- shapelib-1.2.10.orig/debian/changelog +++ shapelib-1.2.10/debian/changelog @@ -0,0 +1,61 @@ +shapelib (1.2.10-3) unstable; urgency=low + + * closing fixed NMU bug + (closes: Bug#308238) + * Updated Standards-Version + * added watch file + + -- Noèl Köthe Fri, 08 Apr 2005 10:51:19 +0200 + +shapelib (1.2.10-2.1) unstable; urgency=low + + * Non-maintainer upload. + * Bug fix: "libshp1: Segfault when freeing a buffer in DBFClose().", + thanks to M Joonas Pihlaja (Closes: #308238). + * Change section of libshp-dev to libdevel to match override + + -- Frank Lichtenheld Mon, 16 May 2005 23:02:24 +0200 + +shapelib (1.2.10-2) unstable; urgency=low + + * added dbfmtsafe.patch from M Joonas Pihlaja + Thanks alot Joonas! + * added manpages from M Joonas Pihlaja + Thanks for your work Joonas! + (closes: Bug#148037) + + -- Noèl Köthe Fri, 08 Apr 2005 10:51:19 +0200 + +shapelib (1.2.10-1) unstable; urgency=low + + * new upstream release + * upstream fixed crashs when there's no .shx file + (closes: Bug#219703) + * updated shapelib homepage URL in control and copyright + * updated my name to correct spelling + * updated Standards-Version + * added /usr/bin/shprewind to the package + * added + + -- Noèl Köthe Fri, 09 Apr 2004 16:27:05 +0200 + +shapelib (1.2.9-3) unstable; urgency=low + + * corrected description + (closes: Bug#163766) + + -- Noel Koethe Mon, 14 Oct 2002 20:02:00 +0200 + +shapelib (1.2.9-2) unstable; urgency=low + + * corrected libary dependency (shapelib1->libshp1) + + -- Noel Koethe Sun, 18 Aug 2002 16:33:00 +0200 + +shapelib (1.2.9-1) unstable; urgency=low + + * Initial Release. + (Closes: Bug#146385) + + -- Noel Koethe Thu, 9 May 2002 13:34:01 +0200 + --- shapelib-1.2.10.orig/debian/watch +++ shapelib-1.2.10/debian/watch @@ -0,0 +1,3 @@ +version=2 +http://dl.maptools.org/dl/shapelib/shapelib-(.*)\.tar\.gz +debian uupdate --- shapelib-1.2.10.orig/debian/shapelib.manpages +++ shapelib-1.2.10/debian/shapelib.manpages @@ -0,0 +1,2 @@ +man/*.1 + --- shapelib-1.2.10.orig/debian/control +++ shapelib-1.2.10/debian/control @@ -0,0 +1,48 @@ +Source: shapelib +Priority: optional +Maintainer: Noèl Köthe +Build-Depends: debhelper (>> 3.0.0), man2html +Standards-Version: 3.6.2 + +Package: shapelib +Section: graphics +Architecture: any +Depends: libshp1 (= ${Source-Version}) +Description: C API for reading and writing ArcView Shapefiles + The Shapefile format is a new working and interchange format + promulagated by ESRI (http://www.esri.com/) for simple vector + data with attributes. It is apparently the only file format + that can be edited in ARCView 2/3, and can also be exported + and imported in Arc/Info. + . + http://shapelib.maptools.org/ + +Package: libshp-dev +Section: libdevel +Architecture: any +Depends: libshp1 (= ${Source-Version}) +Description: C API for reading and writing ArcView Shapefiles + The Shapefile format is a new working and interchange format + promulagated by ESRI (http://www.esri.com/) for simple vector + data with attributes. It is apparently the only file format + that can be edited in ARCView 2/3, and can also be exported + and imported in Arc/Info. + . + This package includes the development files. + . + http://shapelib.maptools.org/ + +Package: libshp1 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Description: C API for reading and writing ArcView Shapefiles + The Shapefile format is a new working and interchange format + promulagated by ESRI (http://www.esri.com/) for simple vector + data with attributes. It is apparently the only file format + that can be edited in ARCView 2/3, and can also be exported + and imported in Arc/Info. + . + This package includes the library. + . + http://shapelib.maptools.org/ --- shapelib-1.2.10.orig/debian/rules +++ shapelib-1.2.10/debian/rules @@ -0,0 +1,122 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This is the debhelper compatibility version to use. +export DH_COMPAT=3 + + + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +# shared library versions, option 1 +version=2.0.5 +major=2 +# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so +#version=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` +#major=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + $(MAKE) lib + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + rm shprewind + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp + #$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + + # have to copy the files by hand.:( + mkdir debian/tmp/ + mkdir debian/tmp/usr/ + mkdir debian/tmp/usr/bin/ + cp dbfadd dbfcreate dbfdump shpadd shpcreate shpdump shprewind shptest \ + debian/tmp/usr/bin/ + + mkdir debian/tmp/usr/lib/ + cp .libs/libshp.a debian/tmp/usr/lib/ + cp libshp.la debian/tmp/usr/lib/ + cp .libs/libshp.so.1.0.1 debian/tmp/usr/lib/ + ln -s libshp.so.1.0.1 libshp.so + ln -s libshp.so.1.0.1 libshp.so.1 + mv libshp.so* debian/tmp/usr/lib/ + + mkdir debian/tmp/usr/include/ + cp shapefil.h debian/tmp/usr/include/ + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_movefiles + +# dh_installdebconf + dh_installdocs *.html +# dh_installexamples +# dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron + dh_installman +# dh_installinfo +# dh_undocumented + dh_installchangelogs ChangeLog + dh_link + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- shapelib-1.2.10.orig/debian/copyright +++ shapelib-1.2.10/debian/copyright @@ -0,0 +1,11 @@ +This package was debianized +by Noèl Köthe on Thu, 9 May 2002 13:34:01 +0200. + +It was downloaded from http://shapelib.maptools.org/ + +Upstream Author: Frank Warmerdam + +Copyright: + +Released under the terms of the GPL; see +/usr/share/common-licenses/LGPL. --- shapelib-1.2.10.orig/debian/dirs +++ shapelib-1.2.10/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin --- shapelib-1.2.10.orig/debian/docs +++ shapelib-1.2.10/debian/docs @@ -0,0 +1 @@ +README.tree --- shapelib-1.2.10.orig/debian/libshp-dev.dirs +++ shapelib-1.2.10/debian/libshp-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include --- shapelib-1.2.10.orig/debian/libshp-dev.files +++ shapelib-1.2.10/debian/libshp-dev.files @@ -0,0 +1,3 @@ +usr/include/* +usr/lib/lib*.a +usr/lib/lib*.so --- shapelib-1.2.10.orig/debian/libshp1.dirs +++ shapelib-1.2.10/debian/libshp1.dirs @@ -0,0 +1 @@ +usr/lib --- shapelib-1.2.10.orig/debian/libshp1.files +++ shapelib-1.2.10/debian/libshp1.files @@ -0,0 +1 @@ +usr/lib/lib*.so.* --- shapelib-1.2.10.orig/debian/shapelib.dirs +++ shapelib-1.2.10/debian/shapelib.dirs @@ -0,0 +1 @@ +usr/bin --- shapelib-1.2.10.orig/debian/shapelib.files +++ shapelib-1.2.10/debian/shapelib.files @@ -0,0 +1 @@ +usr/bin/* --- shapelib-1.2.10.orig/man/dbfcreate.1 +++ shapelib-1.2.10/man/dbfcreate.1 @@ -0,0 +1,88 @@ +.\" Process this file with +.\" groff -man -Tascii dbfcreate.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +dbfcreate \- Create an empty xBase DBF file +.SH SYNOPSIS +.B dbfcreate +.IR "filename" "[[\-s " "fieldname width" "] | [\-n " "fieldname width decimals" ]] ... +.SH DESCRIPTION +Creates an empty DBF file called +.I filename +with columns described by all the +.B \-s +and +.B \-n +options that follow. +.SH OPTIONS +.TP +.BI "\-s " "fieldname width" +adds a column named +.I fieldname +taking textual values of at most +.I width +characters. +.TP +.BI \-n\ fieldname\ width\ decimals +adds a column named +.I fieldname +taking numeric values of at most +.I width +digits and precision of at most +.I decimals +decimal places. The number of digits of precision should be included in +.IR width . +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing +.I filename +argument. +.TP +.B 2 +Failed to create the file +.I filename +for writing. +.TP +.B 3 +Missing +.IR fieldname , width ", or " decimals +argument for a +.B \-s +or +.B \-n +option. +.TP +.B 4 +Failed to add a column given by a +.B \-s +or +.B \-n +option. +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI DBFCreate( filename ") failed." +.TP +.RI DBFAddField( fieldname ",FTString," width ",0) failed." +.TP +.RI DBFAddField( fieldname ",FTDouble," width "," decimals ") failed." +.TP +.RI "Argument incomplete, or unrecognised: " arg +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. +Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote this man page. +.SH "SEE ALSO" +.BR dbfadd (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpadd (1), +.BR shpcreate (1), +.BR shpdump (1), +.BR shprewind (1) --- shapelib-1.2.10.orig/man/dbfdump.1 +++ shapelib-1.2.10/man/dbfdump.1 @@ -0,0 +1,111 @@ +.\" Process this file with +.\" groff -man -Tascii dbfdump.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +dbfdump \- dump xBase DBF files as text +.SH SYNOPSIS +.B dbfdump [\-h] [\-m] [\-r] +.I file +.SH DESCRIPTION +Dumps the contents of +.I file +to standard output. The first line contains the field names appearing +in +.I file, +and each of the following lines contains the field values of a +record. Field names and values are padded by spaces to their field +widths. Empty fields are printed as the string "(NULL)". +.SH OPTIONS +.TP +.B \-h +Prints the column field definitions before other output. Each field +definition consists of a line of the form + +.RI "Field: " index ", Type=" type ", Title=`" "name" "', Width=" "width" ", Decimals=" precision + +where +.I index +is the zero offset column number of the field; the +.I type +indicates the datatype of the field value and is either "Integer", +"Real" or "String"; +.I name +is the field's name; +.I width +is the number of bytes reserved for the field's value; and +.I precision +is the number of decimal places of precision for "Real" type +fields, and is zero for "Integer" and "String" type fields. +.TP +.B \-m +Prints each record in multiline format separated by empty lines. +The first line of a record gives the number of the record in the form + +Records: +.I record_index + +where +.I record_index +is the zero offset number of the record in the file, and +then each field of the record appears on its own line in the format + +.IR name : +.I value + +.TP +.B \-r +Prints the exact bytes occurring in +.I file +for field values and suppresses printing "(NULL)" for +empty values. +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing +.I file +argument. +.TP +.B 2 +Failed to open +.I file. +.TP +.B 3 +There are no fields in +.I file. +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI DBFOpen( file ",""r"") failed." +.TP +There are no fields in this table! +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote +this man page. +.SH BUGS +Unless the +.B \-r +option is given, values in numeric fields that overflow the +.B int +or +.B double +types of the +.B C +language are printed as plus or minus a huge number. For integer +fields the huge value is +.B HUGE_VALL +from and for real fields it is +.BR HUGE_VALF . +.SH "SEE ALSO" +.BR dbf_dump (1), +.BR dbfcreate (1), +.BR dbfadd (1), +.BR shpadd (1), +.BR shpcreate (1), +.BR shpdump (1), +.BR shprewind (1) --- shapelib-1.2.10.orig/man/shprewind.1 +++ shapelib-1.2.10/man/shprewind.1 @@ -0,0 +1,88 @@ +.\" Process this file with +.\" groff -man -Tascii shprewind.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +shprewind \- fix polygon ring orientations in ESRI shapefiles +.SH SYNOPSIS +.B shprewind +.I infile outfile +.SH DESCRIPTION +Makes a copy of the shapefile +.I infile +to +.I outfile +and fixes the orientation of points in the rings of +.BR Polygon ", " PolygonZ ", and " PolygonM +typed shapes to conform to the shapefile specification. According to the +specification, the vertices of outer rings should be oriented +clockwise on the +.I X/Y +plane, and those of inner rings counterclockwise. + +Shapefiles actually consist of two files with the same basename and +extensions +.BR .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 +.I infile +and attempting to open the files +.IB infile .shp +or +.IB infile .SHP, +and +.IB infile .shx +or +.IB infile .SHX +for the respective data and index files. The files to create +from +.I outfile +are determined by stripping any filename extension from +.I outfile +and appending +.B .shp +and +.B .shx +suffixes for the respective data and index files. +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing +.I infile +or +.I outfile +arguments, failed to open shapefile +.I infile +or create shapefile +.IR outfile. +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI "Unable to open:" infile +.TP +.RI "Unable to create:" outfile +.TP +.IR count " objects rewound." +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote +this man page. +.SH BUGS +The implementation assumes that there is at most one outer ring in +each shape, that it is the first ring in a shape, and all other +rings in a shape are inner rings. Polygons inside +.B MultiPatch +shape types aren't rewound. +.SH "SEE ALSO" +.BR dbfadd (1), +.BR dbfcreate (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpadd (1), +.BR shpcreate (1), +.BR shpdump (1) --- shapelib-1.2.10.orig/man/dbfadd.1 +++ shapelib-1.2.10/man/dbfadd.1 @@ -0,0 +1,61 @@ +.\" Process this file with +.\" groff -man -Tascii dbfadd.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +dbfadd \- add a row to an xBase DBF file +.SH SYNOPSIS +.B dbfadd +.I filename fieldvalues... +.SH DESCRIPTION +Adds a row to the DBF file named by +.I filename +with column values given by the +.I fieldvalues +options that follow. A +.B NULL +value is denoted by an empty argument. +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing +.I filename +or +.I fieldvalues +arguments. +.TP +.B 2 +Failed to open +.I filename +for reading and appending. +.TP +.B 3 +Too few values in +.I fieldvalues... +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI DBFOpen( filename ",""rb+"") failed." +.TP +.RI Got\ count1 " fields, but require " count2 +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. +Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote this man page. +.SH BUGS +Field values that are too large to fit in a field are silently +truncated from the right. Numeric field values that can't be parsed by +.BR atof (3) +get undefined values. +.SH "SEE ALSO" +.BR dbfcreate (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpadd (1), +.BR shpcreate (1), +.BR shpdump (1), +.BR shprewind (1) --- shapelib-1.2.10.orig/man/shpdump.1 +++ shapelib-1.2.10/man/shpdump.1 @@ -0,0 +1,316 @@ +.\" Process this file with +.\" groff -man -Tascii shpdump.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +shpdump \- dump an ESRI shapefile as text +.SH SYNOPSIS +.B shpdump [\-validate] +.I file +.SH DESCRIPTION +Prints the contents of the shapefile +.I file +to standard output in textual format. Shapefiles actually consist +of two files with the same basename and extensions +.BR .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 +.I file +and attempting to open the files +.IB file .shp +or +.IB file .SHP, +and +.IB file .shx +or +.IB file .SHX +for the respective data and index files. + +Output consists of a header giving number and type of shapes in the +file and the bounds for the minimum and maximum +.IR X ,\ Y ,\ Z ", and " M +values appearing in the shapes. The header is followed by the +geometric data for each shape in the file. All shapes in the file +should be of the same type, except that +.B NullShape +typed shapes may be intermixed with any other type. The header has +the form +.RS + +Shapefile Type: +.I type +# of Shapes: +.I count + +File Bounds: +.RI ( minX , minY , minZ , minM ) + to\ +.RI ( maxX , maxY , maxZ , maxM ) + +.RE +See section +.B SHAPE TYPES +below for the list of possible shape types. + +Next for each shape in the file a header giving +it's +.IR shape_index , +it's type +.IR type , +number of vertices +.IR nVertices , +number of parts +.IR nParts , +and bounding box is given, followed by the vertex data of each part. +.RS + +Shape:\ +.IR shape_index \ ( type )\ nVertices= nVertices ,\ nParts= nParts + Bounds: +.RI ( minX , minY , minZ , minM ) + to\ +.RI ( maxX , maxY , maxZ , maxM ) + +.RI " " "vertices of the first part" + +.RI "+ " "vertices of the second part..." + +.RI "+ " "vertices of the last part" + +.RE +The +.I shape_index +of a shape is the number of the shape starting from zero in the shape +file. Each vertex has the form +.RS + +.RI ( X , Y , Z , M ) + +.RE +If there are multiple parts then the type of the part is appended +appended to first vertex of each part, and the first vertex of the +second and following parts is preceded by a plus +.RB ( + ) +sign. The part type is +.B Ring +for all shape types except +.B MultiPatch +where it is the type of a surface patch. See below for the description +of possible part types. +.SH SHAPE TYPES +Each type of shape except +.B MultiPatch +typed shapes comes in three flavours: The normal unsuffixed type, where +points lie in +.IR X/Y -space; +a type with suffix +.B M +where points lie in +.IR X/Y -space +and additionally have a +.I measure +value in +.IR M -space; +and finally a type with suffix +.B Z +where points lie in +.IR X/Y/Z -space +and also have a measure value in +.IR M -space. +.\" +.TP +.B NullShape +A shape without data. Shapes of this type may be intermixed with +other shapes and are sometimes used to represented deleted or missing +geometric data for a shape. +.\" +.TP +.B Point " or " PointZ " or " PointM +A single point. +.\" +.TP +.BR Arc " or " ArcZ " or " ArcM +Piecewise linear paths. Shapes of this type may consist of multiple +parts which may or may not intersect and/or connect. Arcs are called +.BR PolyLine s +in the shapefile specification. +.\" +.TP +.BR Polygon " or " PolygonZ " or " PolygonM +Polygon shapes consist of one or more parts, called +.IR rings , +that each define a closed path. Rings must contain at least four +vertices with the first and last vertices being equal, and must not +self-intersect. For shapes of type +.BR Polygon , +the rings define a polygon with optional holes by giving the vertices +of inner rings a counterclockwise orientation and the vertices of +outer rings a clockwise orientation. Intersection and orientation +is always computed in +.IR X/Y -space +and never in +.IR X/Y/M -space. +.\" +.TP +.BR MultiPoint " or " MultiPointZ " or " MultiPointM +A set of points. +.\" +.TP +.BR MultiPatch +A +.B MultiPatch +represents one or more surfaces in +.IR X/Y/Z -space, +and consists of a number of parts called it's +.IR "surface patches" . +Each surface patch describes a either a surface or a hole in another +surface, depending on the type of the patch. Patches may share a +common boundary but may not otherwise intersect. The type of a patch +may be one of +.RS +.TP +.B TriangleStrip +A set of connected triangles. The first three points +define the first triangle and every following point defines +a new triangle using the new point and the two previous points. +.TP +.B TriangleFan +A set of connected triangles. The first three points define the first +triangle and every following point defines a new triangle using the +previous point, the current point, and the first point, thus forming a +fan of triangles around the first point. +.TP +.B OuterRing +The outer ring of a sequence of rings defining a polygon with holes. +All following parts of type +.B InnerRing +are taken to be the holes of the polygon. The sequence of rings +ends with the first +.RB non- InnerRing +typed part or the part of the shape, whichever comes first. +.TP +.B InnerRing +An inner ring in a sequence of rings defining a polygon with holes. +This type of part may only follow an +.B OuterRing +or other +.B InnerRing +typed parts. +.TP +.B FirstRing +The first in a sequence of rings defining a polygon of +unspecified type. The following parts of type +.B Ring +defines the other rings in the polygon. This type of part is used when +the innerness or outerness of a polygon isn't known or applicable. The sequence of rings +defining the polygon ends with the first +.BR non- Ring +typed part or the last part of the shape, whichever comes first. +.TP +.B Ring +A ring in a sequence of rings defining a polygon of unspecified type. +It may only follow a +.B FirstRing +or other +.B Ring +typed parts. +.TP +.B UknownPartType +This type is returned for parts whose type isn't recognised. +.RE +.\" +.TP +.B UnknownShapeType +This type is returned for shapes whose type isn't recognised. +.SH OPTIONS +.TP +.B \-validate +Performs validation on the orientation of inner and outer rings in +.BR Polygon ", " PolygonZ ", and " PolygonM +objects. According to the shapefile specification outer rings should +be given a clockwise orientation, and inner rings that define holes a +counterclockwise orientation. If some rings of a shape are oriented +the wrong way around then the following message is output after +dumping that shape: + +.IR count " rings wound in the wrong direction." + +In addition the total number of shapes with problem rings is output +after the last shape has been dumped: + +.IR count " object has invalid ring orderings." + +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +No shapefile +.I file +was given or it couldn't be opened. +.SH EXAMPLE +.PP +.RS +$ shpdump shapefile.shp + +Shapefile Type: Arc # of Shapes: 3 + +File Bounds: ( 3531586.750, 7253086.100,0,0) + to ( 3536417.463, 7778375.875,0,0) + +Shape:0 (Arc) nVertices=2, nParts=1 + Bounds:( 3536397.797, 7253086.100, 0, 0) + to ( 3536417.463, 7253163.597, 0, 0) + ( 3536397.797, 7253163.597, 0, 0) Ring + ( 3536417.463, 7253086.100, 0, 0) + +Shape:1 (Arc) nVertices=3, nParts=1 + Bounds:( 3458966.390, 7373335.808, 0, 0) + to ( 3459141.856, 7373474.681, 0, 0) + ( 3458966.390, 7373474.681, 0, 0) Ring + ( 3458979.042, 7373466.273, 0, 0) + ( 3459141.856, 7373335.808, 0, 0) + +Shape:2 (Arc) nVertices=7, nParts=1 + Bounds:( 3531586.750, 7777880.500, 0, 0) + to ( 3532930.206, 7778375.875, 0, 0) + ( 3531586.750, 7777880.500, 0, 0) Ring + ( 3532228.265, 7778072.455, 0, 0) + ( 3532310.897, 7778119.445, 0, 0) + ( 3532367.866, 7778144.877, 0, 0) + ( 3532440.559, 7778168.920, 0, 0) + ( 3532506.504, 7778190.785, 0, 0) + ( 3532930.206, 7778375.875, 0, 0) + +$ +.RE +.PP +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI "Unable to open:" file +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote +this man page. +.SH BUGS +The +.B \-validate +option supports only one outer ring in a polygonal shape +and assumes that the first ring in a shape is the outer ring. It doesn't support +polygons inside +.B MultiPatch +shapes. The +.IR X " and " Y +coordinates of a point are printed to three decimal places only. +.SH "SEE ALSO" +.BR dbfadd (1), +.BR dbfcreate (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpadd (1), +.BR shpcreate (1), +.BR shprewind (1) --- shapelib-1.2.10.orig/man/Makefile +++ shapelib-1.2.10/man/Makefile @@ -0,0 +1,16 @@ +SOURCES=dbfdump.1 dbfcreate.1 dbfadd.1 shpdump.1 shpadd.1 shpcreate.1 shprewind.1 shptest.1 +TARGETS=$(addsuffix .cat, $(SOURCES)) $(addsuffix .ps, $(SOURCES)) $(addsuffix .html, $(SOURCES)) + +%.1.cat: %.1 + groff -man -Tascii $^ >$@ + +%.1.ps: %.1 + groff -man -Tps $^ >$@ + +%.1.html: %.1 + man2html $^ >$@ + +all: $(TARGETS) + +clean: + $(RM) *.1.cat *.1.ps *.1.html *~ --- shapelib-1.2.10.orig/man/shpadd.1 +++ shapelib-1.2.10/man/shpadd.1 @@ -0,0 +1,85 @@ +.\" Process this file with +.\" groff -man -Tascii shpadd.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +shpadd \- append a shape to an ESRI shapefile +.SH SYNOPSIS +.B shpadd +.I file +.RI "[[" "x y" "] [+]]*" +.SH DESCRIPTION +Appends a shape to the shapefile determined from +.IR file . +The geometric data of the new shape consists of lists of +.I X/Y +points on the command line grouped into +.IR parts , +with points in different parts separated by a plus +.RB ( + ) +sign. If no points or parts are given then a shape of type +.B NullShape +is appended to the shapefile, and otherwise the type of the new shape +is determined by the shapefile's header. See +.BR 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 +.BR shpadd (1). + +Shapefiles actually consist of two files with the same basename and +extensions +.BR .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 +.I file +and attempting to open the files +.IB file .shp +or +.IB file .SHP, +and +.IB file .shx +or +.IB file .SHX +for the respective data and index files. + +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing +.I file +argument, the shapefile can't be opened, or the program +ran out of memory. +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI "Unable to open:" file +.TP +.RI "Out of memory" +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote +this man page. +.SH BUGS +Coordinate values that can't be +be parsed by +.BR sscanf (3) +get undefined values. There's no way to give measure or +.I Z +data to vertices in a shape, but those are always set to zero +if the shapefile's shape type requires those values. +.B MultiPatch +shape types aren't supported. +.SH "SEE ALSO" +.BR dbfadd (1), +.BR dbfcreate (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpcreate (1), +.BR shpdump (1), +.BR shprewind (1) --- shapelib-1.2.10.orig/man/shpcreate.1 +++ shapelib-1.2.10/man/shpcreate.1 @@ -0,0 +1,68 @@ +.\" Process this file with +.\" groff -man -Tascii shpcreate.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +shpcreate \- create an empty ESRI shapefile +.SH SYNOPSIS +.B shpcreate +.I file shapetype +.SH DESCRIPTION +Creates an empty shapefile supporting shapes of the given type +.IR shapetype . +Shapefiles actually consist of two files with the same basename and +extensions +.BR .shp \ and\ .shx " (or " .SHP \ and\ .SHX ") " +containing the shape data and shape index respectively. The files +to create are determined by first stripping any filename extension +from +.I file +and attempting to create the files +.IB file .shp +or +.IB file .SHP, +and +.IB file .shx +or +.IB file .SHX +for the respective data and index files. The supported values for the +.I shapetype +argument are: +.BR point ", " arc ", " polygon ", and " multipoint . +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing +.I file +or +.I shapetype +argument. +.TP +.B 2 +Unknown +.IR shapetype . +.TP +.B 3 +Unable to create the shapefile. +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI "Shape Type `" shapetype "' not recognised." +.TP +.RI "Unable to create:" file +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote +this man page. +.SH "SEE ALSO" +.BR dbfadd (1), +.BR dbfcreate (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpadd (1), +.BR shpdump (1), +.BR shprewind (1) --- shapelib-1.2.10.orig/man/shptest.1 +++ shapelib-1.2.10/man/shptest.1 @@ -0,0 +1,89 @@ +.\" Process this file with +.\" groff -man -Tascii shptest.1 +.\" +.TH SHAPELIB 1 "OCTOBER 2004" "shapelib" "User Commands" +.SH NAME +shptest \- create some shapefiles for testing +.SH SYNOPSIS +.B shptest +.I num +.SH DESCRIPTION +Writes out a shapefile consisting of files +.RI test num .shp +and +.RI test num .shx +in the current directory. The +.I num +argument specifies the type of shapes in the shapefile to create and takes +values from: +.TP +.B 0 +.B NullShape +.TP +.B 1 +.B Point +.TP +.B 2 +.B PointZ +.TP +.B 3 +.B PointM +.TP +.B 4 +.B MultiPoint +.TP +.B 5 +.B MultiPointZ +.TP +.B 6 +.B MultiPointM +.TP +.B 7 +.B Arc +.TP +.B 8 +.B ArcZ +.TP +.B 9 +.B ArcM +.TP +.B 10 +.B Polygon +.TP +.B 11 +.B PolygonZ +.TP +.B 12 +.B PolygonM +.TP +.B 13 +.B MultiPatch +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing argument. +.TP +.B 10 +Test +.RI ` num ' +not recognised. +.SH DIAGNOSTICS +The following diagnostics may be issued on stdout: +.TP +.RI "Test `" num "' not recognised." +.SH AUTHORS +Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the +.B shapelib +shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote +this man page. +.SH "SEE ALSO" +.BR dbfadd (1), +.BR dbfcreate (1), +.BR dbfdump (1), +.BR dbf_dump (1), +.BR shpcreate (1), +.BR shpdump (1), +.BR shprewind (1)