PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
shapefil.h
Go to the documentation of this file.
1#ifndef SHAPEFILE_H_INCLUDED
2#define SHAPEFILE_H_INCLUDED
3
4/******************************************************************************
5 * $Id$
6 *
7 * Project: Shapelib
8 * Purpose: Primary include file for Shapelib.
9 * Author: Frank Warmerdam, warmerdam@pobox.com
10 *
11 ******************************************************************************
12 * Copyright (c) 1999, Frank Warmerdam
13 * Copyright (c) 2012-2016, Even Rouault <even dot rouault at mines-paris dot org>
14 *
15 * This software is available under the following "MIT Style" license,
16 * or at the option of the licensee under the LGPL (see COPYING). This
17 * option is discussed in more detail in shapelib.html.
18 *
19 * --
20 *
21 * Permission is hereby granted, free of charge, to any person obtaining a
22 * copy of this software and associated documentation files (the "Software"),
23 * to deal in the Software without restriction, including without limitation
24 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
25 * and/or sell copies of the Software, and to permit persons to whom the
26 * Software is furnished to do so, subject to the following conditions:
27 *
28 * The above copyright notice and this permission notice shall be included
29 * in all copies or substantial portions of the Software.
30 *
31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
34 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
36 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
37 * DEALINGS IN THE SOFTWARE.
38 ******************************************************************************
39 *
40 * $Log$
41 * Revision 1.56 2018-08-16 15:39:07 erouault
42 * * shpopen.c, dbfopen.c, shptree.c, sbnsearch.c: resyc with GDAL
43 * internal shapelib. Mostly to allow building those files as C++
44 * without warning. Also add FTDate entry in DBFFieldType
45 * (see https://github.com/OSGeo/gdal/pull/308). And some other
46 * code cleanups
47 *
48 * Revision 1.55 2016-12-05 18:44:08 erouault
49 * * dbfopen.c, shapefil.h: write DBF end-of-file character 0x1A by default.
50 * This behaviour can be controlled with the DBFSetWriteEndOfFileChar()
51 * function.
52 *
53 * Revision 1.54 2016-12-05 12:44:05 erouault
54 * * Major overhaul of Makefile build system to use autoconf/automake.
55 *
56 * * Warning fixes in contrib/
57 *
58 * Revision 1.53 2016-12-04 15:30:15 erouault
59 * * shpopen.c, dbfopen.c, shptree.c, shapefil.h: resync with
60 * GDAL Shapefile driver. Mostly cleanups. SHPObject and DBFInfo
61 * structures extended with new members. New functions:
62 * DBFSetLastModifiedDate, SHPOpenLLEx, SHPRestoreSHX,
63 * SHPSetFastModeReadObject
64 *
65 * * sbnsearch.c: new file to implement original ESRI .sbn spatial
66 * index reading. (no write support). New functions:
67 * SBNOpenDiskTree, SBNCloseDiskTree, SBNSearchDiskTree,
68 * SBNSearchDiskTreeInteger, SBNSearchFreeIds
69 *
70 * * Makefile, makefile.vc, CMakeLists.txt, shapelib.def: updates
71 * with new file and symbols.
72 *
73 * * commit: helper script to cvs commit
74 *
75 * Revision 1.52 2011-12-11 22:26:46 fwarmerdam
76 * upgrade .qix access code to use SAHooks (gdal #3365)
77 *
78 * Revision 1.51 2011-07-24 05:59:25 fwarmerdam
79 * minimize use of CPLError in favor of SAHooks.Error()
80 *
81 * Revision 1.50 2011-05-13 17:35:17 fwarmerdam
82 * added DBFReorderFields() and DBFAlterFields() functions (from Even)
83 *
84 * Revision 1.49 2011-04-16 14:38:21 fwarmerdam
85 * avoid warnings with gcc on SHP_CVSID
86 *
87 * Revision 1.48 2010-08-27 23:42:52 fwarmerdam
88 * add SHPAPI_CALL attribute in code
89 *
90 * Revision 1.47 2010-01-28 11:34:34 fwarmerdam
91 * handle the shape file length limits more gracefully (#3236)
92 *
93 * Revision 1.46 2008-11-12 14:28:15 fwarmerdam
94 * DBFCreateField() now works on files with records
95 *
96 * Revision 1.45 2008/11/11 17:47:10 fwarmerdam
97 * added DBFDeleteField() function
98 *
99 * Revision 1.44 2008/01/16 20:05:19 bram
100 * Add file hooks that accept UTF-8 encoded filenames on some platforms. Use SASetupUtf8Hooks
101 * tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability. Currently, this
102 * is only available on the Windows platform that decodes the UTF-8 filenames to wide
103 * character strings and feeds them to _wfopen and _wremove.
104 *
105 * Revision 1.43 2008/01/10 16:35:30 fwarmerdam
106 * avoid _ prefix on #defined symbols (bug 1840)
107 *
108 * Revision 1.42 2007/12/18 18:28:14 bram
109 * - create hook for client specific atof (bugzilla ticket 1615)
110 * - check for NULL handle before closing cpCPG file, and close after reading.
111 *
112 * Revision 1.41 2007/12/15 20:25:32 bram
113 * dbfopen.c now reads the Code Page information from the DBF file, and exports
114 * this information as a string through the DBFGetCodePage function. This is
115 * either the number from the LDID header field ("LDID/<number>") or as the
116 * content of an accompanying .CPG file. When creating a DBF file, the code can
117 * be set using DBFCreateEx.
118 *
119 * Revision 1.40 2007/12/06 07:00:25 fwarmerdam
120 * dbfopen now using SAHooks for fileio
121 *
122 * Revision 1.39 2007/12/04 20:37:56 fwarmerdam
123 * preliminary implementation of hooks api for io and errors
124 *
125 * Revision 1.38 2007/11/21 22:39:56 fwarmerdam
126 * close shx file in readonly mode (GDAL #1956)
127 *
128 * Revision 1.37 2007/10/27 03:31:14 fwarmerdam
129 * limit default depth of tree to 12 levels (gdal ticket #1594)
130 *
131 * Revision 1.36 2007/09/10 23:33:15 fwarmerdam
132 * Upstreamed support for visibility flag in SHPAPI_CALL for the needs
133 * of GDAL (gdal ticket #1810).
134 *
135 * Revision 1.35 2007/09/03 19:48:10 fwarmerdam
136 * move DBFReadAttribute() static dDoubleField into dbfinfo
137 *
138 * Revision 1.34 2006/06/17 15:33:32 fwarmerdam
139 * added pszWorkField - bug 1202 (rso)
140 *
141 * Revision 1.33 2006/02/15 01:14:30 fwarmerdam
142 * added DBFAddNativeFieldType
143 *
144 * Revision 1.32 2006/01/26 15:07:32 fwarmerdam
145 * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
146 *
147 * Revision 1.31 2006/01/05 01:27:27 fwarmerdam
148 * added dbf deletion mark/fetch
149 *
150 * Revision 1.30 2005/01/03 22:30:13 fwarmerdam
151 * added support for saved quadtrees
152 *
153 * Revision 1.29 2004/09/26 20:09:35 fwarmerdam
154 * avoid rcsid warnings
155 *
156 * Revision 1.28 2003/12/29 06:02:18 fwarmerdam
157 * added cpl_error.h option
158 *
159 * Revision 1.27 2003/04/21 18:30:37 warmerda
160 * added header write/update public methods
161 *
162 * Revision 1.26 2002/09/29 00:00:08 warmerda
163 * added FTLogical and logical attribute read/write calls
164 *
165 * Revision 1.25 2002/05/07 13:46:30 warmerda
166 * added DBFWriteAttributeDirectly().
167 *
168 * Revision 1.24 2002/04/10 16:59:54 warmerda
169 * added SHPRewindObject
170 *
171 * Revision 1.23 2002/01/15 14:36:07 warmerda
172 * updated email address
173 *
174 * Revision 1.22 2002/01/15 14:32:00 warmerda
175 * try to improve SHPAPI_CALL docs
176 */
177
178#include <stdio.h>
179
180#ifdef USE_DBMALLOC
181#include <dbmalloc.h>
182#endif
183
184#ifdef USE_CPL
185#include "cpl_conv.h"
186#endif
187
188#ifdef __cplusplus
189extern "C" {
190#endif
191
192/************************************************************************/
193/* Configuration options. */
194/************************************************************************/
195
196/* -------------------------------------------------------------------- */
197/* Should the DBFReadStringAttribute() strip leading and */
198/* trailing white space? */
199/* -------------------------------------------------------------------- */
200#define TRIM_DBF_WHITESPACE
201
202/* -------------------------------------------------------------------- */
203/* Should we write measure values to the Multipatch object? */
204/* Reportedly ArcView crashes if we do write it, so for now it */
205/* is disabled. */
206/* -------------------------------------------------------------------- */
207#define DISABLE_MULTIPATCH_MEASURE
208
209/* -------------------------------------------------------------------- */
210/* SHPAPI_CALL */
211/* */
212/* The following two macros are present to allow forcing */
213/* various calling conventions on the Shapelib API. */
214/* */
215/* To force __stdcall conventions (needed to call Shapelib */
216/* from Visual Basic and/or Dephi I believe) the makefile could */
217/* be modified to define: */
218/* */
219/* /DSHPAPI_CALL=__stdcall */
220/* */
221/* If it is desired to force export of the Shapelib API without */
222/* using the shapelib.def file, use the following definition. */
223/* */
224/* /DSHAPELIB_DLLEXPORT */
225/* */
226/* To get both at once it will be necessary to hack this */
227/* include file to define: */
228/* */
229/* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
230/* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
231/* */
232/* The complexity of the situation is partly caused by the */
233/* peculiar requirement of Visual C++ that __stdcall appear */
234/* after any "*"'s in the return value of a function while the */
235/* __declspec(dllexport) must appear before them. */
236/* -------------------------------------------------------------------- */
237
238#ifdef SHAPELIB_DLLEXPORT
239# define SHPAPI_CALL __declspec(dllexport)
240# define SHPAPI_CALL1(x) __declspec(dllexport) x
241#endif
242
243#ifndef SHPAPI_CALL
244# if defined(USE_GCC_VISIBILITY_FLAG)
245# define SHPAPI_CALL __attribute__ ((visibility("default")))
246# define SHPAPI_CALL1(x) __attribute__ ((visibility("default"))) x
247# else
248# define SHPAPI_CALL
249# endif
250#endif
251
252#ifndef SHPAPI_CALL1
253# define SHPAPI_CALL1(x) x SHPAPI_CALL
254#endif
255
256/* -------------------------------------------------------------------- */
257/* Macros for controlling CVSID and ensuring they don't appear */
258/* as unreferenced variables resulting in lots of warnings. */
259/* -------------------------------------------------------------------- */
260#ifndef DISABLE_CVSID
261# if defined(__GNUC__) && __GNUC__ >= 4
262# define SHP_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string;
263# else
264# define SHP_CVSID(string) static const char cpl_cvsid[] = string; \
265static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
266# endif
267#else
268# define SHP_CVSID(string)
269#endif
270
271/* -------------------------------------------------------------------- */
272/* On some platforms, additional file IO hooks are defined that */
273/* UTF-8 encoded filenames Unicode filenames */
274/* -------------------------------------------------------------------- */
275#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
276# define SHPAPI_WINDOWS
277# define SHPAPI_UTF8_HOOKS
278#endif
279
280/* -------------------------------------------------------------------- */
281/* IO/Error hook functions. */
282/* -------------------------------------------------------------------- */
283typedef int *SAFile;
284
285#ifndef SAOffset
286typedef unsigned long SAOffset;
287#endif
288
289typedef struct {
290 SAFile (*FOpen) ( const char *filename, const char *access);
291 SAOffset (*FRead) ( void *p, SAOffset size, SAOffset nmemb, SAFile file);
292 SAOffset (*FWrite)( void *p, SAOffset size, SAOffset nmemb, SAFile file);
293 SAOffset (*FSeek) ( SAFile file, SAOffset offset, int whence );
294 SAOffset (*FTell) ( SAFile file );
295 int (*FFlush)( SAFile file );
296 int (*FClose)( SAFile file );
297 int (*Remove) ( const char *filename );
298
299 void (*Error) ( const char *message );
300 double (*Atof) ( const char *str );
301} SAHooks;
302
304#ifdef SHPAPI_UTF8_HOOKS
305void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
306#endif
307
308/************************************************************************/
309/* SHP Support. */
310/************************************************************************/
311typedef struct tagSHPObject SHPObject;
312
313typedef struct
314{
316
319
320 int nShapeType; /* SHPT_* */
321
322 unsigned int nFileSize; /* SHP file */
323
326 unsigned int*panRecOffset;
327 unsigned int *panRecSize;
328
329 double adBoundsMin[4];
330 double adBoundsMax[4];
331
333
334 unsigned char *pabyRec;
336
338 unsigned char *pabyObjectBuf;
341} SHPInfo;
342
344
345/* -------------------------------------------------------------------- */
346/* Shape types (nSHPType) */
347/* -------------------------------------------------------------------- */
348#define SHPT_NULL 0
349#define SHPT_POINT 1
350#define SHPT_ARC 3
351#define SHPT_POLYGON 5
352#define SHPT_MULTIPOINT 8
353#define SHPT_POINTZ 11
354#define SHPT_ARCZ 13
355#define SHPT_POLYGONZ 15
356#define SHPT_MULTIPOINTZ 18
357#define SHPT_POINTM 21
358#define SHPT_ARCM 23
359#define SHPT_POLYGONM 25
360#define SHPT_MULTIPOINTM 28
361#define SHPT_MULTIPATCH 31
362
363/* -------------------------------------------------------------------- */
364/* Part types - everything but SHPT_MULTIPATCH just uses */
365/* SHPP_RING. */
366/* -------------------------------------------------------------------- */
367
368#define SHPP_TRISTRIP 0
369#define SHPP_TRIFAN 1
370#define SHPP_OUTERRING 2
371#define SHPP_INNERRING 3
372#define SHPP_FIRSTRING 4
373#define SHPP_RING 5
374
375/* -------------------------------------------------------------------- */
376/* SHPObject - represents on shape (without attributes) read */
377/* from the .shp file. */
378/* -------------------------------------------------------------------- */
380{
382
383 int nShapeId; /* -1 is unknown/unassigned */
384
388
390 double *padfX;
391 double *padfY;
392 double *padfZ;
393 double *padfM;
394
395 double dfXMin;
396 double dfYMin;
397 double dfZMin;
398 double dfMMin;
399
400 double dfXMax;
401 double dfYMax;
402 double dfZMax;
403 double dfMMax;
404
407};
408
409/* -------------------------------------------------------------------- */
410/* SHP API Prototypes */
411/* -------------------------------------------------------------------- */
412
413/* If pszAccess is read-only, the fpSHX field of the returned structure */
414/* will be NULL as it is not necessary to keep the SHX file open */
416 SHPOpen( const char * pszShapeFile, const char * pszAccess );
418 SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
419 SAHooks *psHooks );
421 SHPOpenLLEx( const char *pszShapeFile, const char *pszAccess,
422 SAHooks *psHooks, int bRestoreSHX );
423
424int SHPAPI_CALL
425 SHPRestoreSHX( const char *pszShapeFile, const char *pszAccess,
426 SAHooks *psHooks );
427
428/* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the SHPHandle. */
429/* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
430/* The SHPObject padfZ and padfM members may be NULL depending on the geometry */
431/* type. It is illegal to free at hand any of the pointer members of the SHPObject structure */
432void SHPAPI_CALL SHPSetFastModeReadObject( SHPHandle hSHP, int bFastMode );
433
435 SHPCreate( const char * pszShapeFile, int nShapeType );
437 SHPCreateLL( const char * pszShapeFile, int nShapeType,
438 SAHooks *psHooks );
439void SHPAPI_CALL
440 SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
441 double * padfMinBound, double * padfMaxBound );
442
444 SHPReadObject( SHPHandle hSHP, int iShape );
445int SHPAPI_CALL
446 SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
447
448void SHPAPI_CALL
449 SHPDestroyObject( SHPObject * psObject );
450void SHPAPI_CALL
451 SHPComputeExtents( SHPObject * psObject );
453 SHPCreateObject( int nSHPType, int nShapeId, int nParts,
454 const int * panPartStart, const int * panPartType,
455 int nVertices,
456 const double * padfX, const double * padfY,
457 const double * padfZ, const double * padfM );
460 const double * padfX,
461 const double * padfY,
462 const double * padfZ );
463
464int SHPAPI_CALL
466
467void SHPAPI_CALL SHPClose( SHPHandle hSHP );
469
470const char SHPAPI_CALL1(*)
471 SHPTypeName( int nSHPType );
472const char SHPAPI_CALL1(*)
473 SHPPartTypeName( int nPartType );
474
475/* -------------------------------------------------------------------- */
476/* Shape quadtree indexing API. */
477/* -------------------------------------------------------------------- */
478
479/* this can be two or four for binary or quad tree */
480#define MAX_SUBNODE 4
481
482/* upper limit of tree levels for automatic estimation */
483#define MAX_DEFAULT_TREE_DEPTH 12
484
485typedef struct shape_tree_node
486{
487 /* region covered by this node */
488 double adfBoundsMin[4];
489 double adfBoundsMax[4];
490
491 /* list of shapes stored at this node. The papsShapeObj pointers
492 or the whole list can be NULL */
496
499
501
512
514 SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
515 double *padfBoundsMin, double *padfBoundsMax );
516void SHPAPI_CALL
517 SHPDestroyTree( SHPTree * hTree );
518
519int SHPAPI_CALL
520 SHPWriteTree( SHPTree *hTree, const char * pszFilename );
521
522int SHPAPI_CALL
523 SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject );
524int SHPAPI_CALL
526
527void SHPAPI_CALL
529
532 double * padfBoundsMin,
533 double * padfBoundsMax,
534 int * );
535int SHPAPI_CALL
536 SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
537
539SHPSearchDiskTree( FILE *fp,
540 double *padfBoundsMin, double *padfBoundsMax,
541 int *pnShapeCount );
542
543typedef struct SHPDiskTreeInfo* SHPTreeDiskHandle;
544
545SHPTreeDiskHandle SHPAPI_CALL
546 SHPOpenDiskTree( const char* pszQIXFilename,
547 SAHooks *psHooks );
548
549void SHPAPI_CALL
550 SHPCloseDiskTree( SHPTreeDiskHandle hDiskTree );
551
553SHPSearchDiskTreeEx( SHPTreeDiskHandle hDiskTree,
554 double *padfBoundsMin, double *padfBoundsMax,
555 int *pnShapeCount );
556
557int SHPAPI_CALL
558 SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHooks );
559
560/* -------------------------------------------------------------------- */
561/* SBN Search API */
562/* -------------------------------------------------------------------- */
563
564typedef struct SBNSearchInfo* SBNSearchHandle;
565
567 SBNOpenDiskTree( const char* pszSBNFilename,
568 SAHooks *psHooks );
569
570void SHPAPI_CALL
572
575 double *padfBoundsMin, double *padfBoundsMax,
576 int *pnShapeCount );
577
578int SHPAPI_CALL1(*)
579SBNSearchDiskTreeInteger( SBNSearchHandle hSBN,
580 int bMinX, int bMinY, int bMaxX, int bMaxY,
581 int *pnShapeCount );
582
583void SHPAPI_CALL SBNSearchFreeIds( int* panShapeId );
584
585/************************************************************************/
586/* DBF Support. */
587/************************************************************************/
588typedef struct
589{
591
593
595
596 int nRecordLength; /* Must fit on uint16 */
597 int nHeaderLength; /* File header length (32) + field
598 descriptor length + spare space.
599 Must fit on uint16 */
605
606 char *pszHeader; /* Field descriptors */
607
611
614
617
618 union
619 {
622 } fieldValue;
623
626
627 int nUpdateYearSince1900; /* 0-255 */
628 int nUpdateMonth; /* 1-12 */
629 int nUpdateDay; /* 1-31 */
630
631 int bWriteEndOfFileChar; /* defaults to TRUE */
632
634} DBFInfo;
635
637
646
647/* Field descriptor/header size */
648#define XBASE_FLDHDR_SZ 32
649/* Shapelib read up to 11 characters, even if only 10 should normally be used */
650#define XBASE_FLDNAME_LEN_READ 11
651/* On writing, we limit to 10 characters */
652#define XBASE_FLDNAME_LEN_WRITE 10
653/* Normally only 254 characters should be used. We tolerate 255 historically */
654#define XBASE_FLD_MAX_WIDTH 255
655
657 DBFOpen( const char * pszDBFFile, const char * pszAccess );
659 DBFOpenLL( const char * pszDBFFile, const char * pszAccess,
660 SAHooks *psHooks );
662 DBFCreate( const char * pszDBFFile );
664 DBFCreateEx( const char * pszDBFFile, const char * pszCodePage );
666 DBFCreateLL( const char * pszDBFFile, const char * pszCodePage, SAHooks *psHooks );
667
668int SHPAPI_CALL
670int SHPAPI_CALL
672int SHPAPI_CALL
673 DBFAddField( DBFHandle hDBF, const char * pszFieldName,
674 DBFFieldType eType, int nWidth, int nDecimals );
675
676int SHPAPI_CALL
677 DBFAddNativeFieldType( DBFHandle hDBF, const char * pszFieldName,
678 char chType, int nWidth, int nDecimals );
679
680int SHPAPI_CALL
681 DBFDeleteField( DBFHandle hDBF, int iField );
682
683int SHPAPI_CALL
684 DBFReorderFields( DBFHandle psDBF, int* panMap );
685
686int SHPAPI_CALL
687 DBFAlterFieldDefn( DBFHandle psDBF, int iField, const char * pszFieldName,
688 char chType, int nWidth, int nDecimals );
689
691 DBFGetFieldInfo( DBFHandle psDBF, int iField,
692 char * pszFieldName, int * pnWidth, int * pnDecimals );
693
694int SHPAPI_CALL
695 DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
696
697int SHPAPI_CALL
698 DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField );
699double SHPAPI_CALL
700 DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );
701const char SHPAPI_CALL1(*)
702 DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );
703const char SHPAPI_CALL1(*)
704 DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField );
705int SHPAPI_CALL
706 DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
707
708int SHPAPI_CALL
709 DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField,
710 int nFieldValue );
711int SHPAPI_CALL
712 DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
713 double dFieldValue );
714int SHPAPI_CALL
715 DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField,
716 const char * pszFieldValue );
717int SHPAPI_CALL
718 DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );
719
720int SHPAPI_CALL
721 DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
722 const char lFieldValue);
723int SHPAPI_CALL
724 DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
725 void * pValue );
726const char SHPAPI_CALL1(*)
727 DBFReadTuple(DBFHandle psDBF, int hEntity );
728int SHPAPI_CALL
729 DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
730
731int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
732int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
733 int bIsDeleted );
734
736 DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
737
738void SHPAPI_CALL
739 DBFClose( DBFHandle hDBF );
740void SHPAPI_CALL
742char SHPAPI_CALL
743 DBFGetNativeFieldType( DBFHandle hDBF, int iField );
744
745const char SHPAPI_CALL1(*)
747
748void SHPAPI_CALL
749 DBFSetLastModifiedDate( DBFHandle psDBF, int nYYSince1900, int nMM, int nDD );
750
751void SHPAPI_CALL DBFSetWriteEndOfFileChar( DBFHandle psDBF, int bWriteFlag );
752
753#ifdef __cplusplus
754}
755#endif
756
757#endif /* ndef SHAPEFILE_H_INCLUDED */
const char SHPAPI_CALL1 * DBFReadLogicalAttribute(DBFHandle psDBF, int iRecord, int iField){ return STATIC_CAST(const char *, DBFReadAttribute(psDBF, iRecord, iField, 'L')
void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
Definition dbfopen.c:337
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple)
Definition dbfopen.c:1585
#define str(s)
int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
Definition dbfopen.c:1528
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
Definition shpopen.c:988
DBFFieldType
Definition shapefil.h:638
@ FTDouble
Definition shapefil.h:641
@ FTString
Definition shapefil.h:639
@ FTInvalid
Definition shapefil.h:644
@ FTLogical
Definition shapefil.h:642
@ FTDate
Definition shapefil.h:643
@ FTInteger
Definition shapefil.h:640
void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, SAHooks *psHooks)
Definition dbfopen.c:388
const char SHPAPI_CALL1 * DBFGetCodePage(DBFHandle psDBF);void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD
Definition dbfopen.c:1817
int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
Definition dbfopen.c:1775
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
Definition dbfopen.c:1246
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition dbfopen.c:2079
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
Definition dbfopen.c:304
int SHPAPI_CALL SHPTreeRemoveShapeId(SHPTree *hTree, int nShapeId)
int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
Definition dbfopen.c:1544
struct shape_tree_node SHPTreeNode
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
int SHPAPI_CALL1 * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename, SAHooks *psHooks
#define MAX_SUBNODE
Definition shapefil.h:480
int SHPAPI_CALL1 * SHPSearchDiskTreeEx(SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHooks
DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess)
Definition dbfopen.c:351
int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename)
int SHPAPI_CALL1 * SBNSearchDiskTree(SBNSearchHandle hSBN, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL1(*) SBNSearchDiskTreeInteger(SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount
int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
Definition dbfopen.c:1111
int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition dbfopen.c:844
void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
Definition shpopen.c:935
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
Definition shpopen.c:888
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
Definition dbfopen.c:1514
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
Definition shpopen.c:2652
SHPObject SHPAPI_CALL1 * SHPCreateObject(int nSHPType, int nShapeId, int nParts, const int *panPartStart, const int *panPartType, int nVertices, const double *padfX, const double *padfY, const double *padfZ, const double *padfM);SHPObject SHPAPI_CALL1(*) SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ
DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename)
Definition dbfopen.c:1659
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *, int
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
Definition shpopen.c:1172
DBFInfo * DBFHandle
Definition shapefil.h:636
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, SAHooks *psHooks)
Definition shpopen.c:1006
int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
Definition dbfopen.c:1728
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
Definition dbfopen.c:1558
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
Definition dbfopen.c:1259
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
Definition shpopen.c:291
SHPInfo * SHPHandle
Definition shapefil.h:343
int * SAFile
Definition shapefil.h:283
int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField)
Definition dbfopen.c:1226
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
Definition shpopen.c:956
SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename, SAHooks *psHooks)
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
Definition shpopen.c:1842
int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
Definition dbfopen.c:797
int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
Definition dbfopen.c:1571
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
Definition dbfopen.c:669
SHPTree SHPAPI_CALL1 * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, double *padfBoundsMin, double *padfBoundsMax);void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree
#define SHPAPI_CALL
Definition shapefil.h:248
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
Definition dbfopen.c:656
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
Definition dbfopen.c:606
#define SHPAPI_CALL1(x)
Definition shapefil.h:253
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
struct SBNSearchInfo * SBNSearchHandle
Definition shapefil.h:564
void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
Definition shpopen.c:2562
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks, int bRestoreSHX)
Definition shpopen.c:679
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
Definition dbfopen.c:2317
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
Definition shpopen.c:329
void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN)
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, SAHooks *psHooks)
Definition dbfopen.c:686
const char SHPAPI_CALL1 * DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);const char SHPAPI_CALL1(*) DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField
int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject)
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
Definition dbfopen.c:1446
int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, int *panMap)
Definition dbfopen.c:1958
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
Definition shpopen.c:147
int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
Definition dbfopen.c:1750
unsigned long SAOffset
Definition shapefil.h:286
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
Definition safileio.c:194
int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
Definition shpopen.c:703
char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField)
Definition dbfopen.c:1710
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
Definition dbfopen.c:1131
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
Definition dbfopen.c:1274
psObject nShapeId
Definition shpopen.c:1221
psObject nVertices
Definition shpopen.c:1314
psObject nSHPType
Definition shpopen.c:1220
const char SHPAPI_CALL1 * SHPPartTypeName(int nPartType){ switch(nPartType
Definition shpopen.c:2619
SHPObject SHPAPI_CALL1 * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ){ return(SHPCreateObject(nSHPType, -1, 0, SHPLIB_NULLPTR, SHPLIB_NULLPTR, nVertices, padfX, padfY, padfZ, SHPLIB_NULLPTR)
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
Definition shpopen.c:1345
int nUpdateDay
Definition shapefil.h:629
int bWriteEndOfFileChar
Definition shapefil.h:631
int nRecordLength
Definition shapefil.h:596
int * panFieldOffset
Definition shapefil.h:601
int * panFieldDecimals
Definition shapefil.h:603
char * pszCodePage
Definition shapefil.h:625
int nUpdateMonth
Definition shapefil.h:628
int nFields
Definition shapefil.h:600
int bUpdated
Definition shapefil.h:616
int nHeaderLength
Definition shapefil.h:597
int * panFieldSize
Definition shapefil.h:602
char * pszCurrentRecord
Definition shapefil.h:610
int bCurrentRecordModified
Definition shapefil.h:609
char * pszHeader
Definition shapefil.h:606
int nUpdateYearSince1900
Definition shapefil.h:627
SAFile fp
Definition shapefil.h:592
char * pachFieldType
Definition shapefil.h:604
int bRequireNextWriteSeek
Definition shapefil.h:633
int nWorkFieldLength
Definition shapefil.h:612
SAHooks sHooks
Definition shapefil.h:590
int bNoHeader
Definition shapefil.h:615
int iLanguageDriver
Definition shapefil.h:624
int nRecords
Definition shapefil.h:594
char * pszWorkField
Definition shapefil.h:613
double dfDoubleField
Definition shapefil.h:620
int nIntField
Definition shapefil.h:621
int nCurrentRecord
Definition shapefil.h:608
SAFile fpSHX
Definition shapefil.h:318
int nShapeType
Definition shapefil.h:320
SAFile fpSHP
Definition shapefil.h:317
int nMaxRecords
Definition shapefil.h:325
SHPObject * psCachedObject
Definition shapefil.h:340
int nBufSize
Definition shapefil.h:335
unsigned int * panRecSize
Definition shapefil.h:327
SAHooks sHooks
Definition shapefil.h:315
int nRecords
Definition shapefil.h:324
unsigned char * pabyObjectBuf
Definition shapefil.h:338
int bUpdated
Definition shapefil.h:332
int nObjectBufSize
Definition shapefil.h:339
unsigned int nFileSize
Definition shapefil.h:322
unsigned int * panRecOffset
Definition shapefil.h:326
int bFastModeReadObject
Definition shapefil.h:337
unsigned char * pabyRec
Definition shapefil.h:334
SHPTreeNode * psRoot
Definition shapefil.h:510
SHPHandle hSHP
Definition shapefil.h:504
int nDimension
Definition shapefil.h:507
int nMaxDepth
Definition shapefil.h:506
int nTotalCount
Definition shapefil.h:508
SHPObject ** papsShapeObj
Definition shapefil.h:495
int * panShapeIds
Definition shapefil.h:494
struct shape_tree_node * apsSubNode[MAX_SUBNODE]
Definition shapefil.h:498
double adfBoundsMax[4]
Definition shapefil.h:489
double adfBoundsMin[4]
Definition shapefil.h:488
int bFastModeReadObject
Definition shapefil.h:406
double dfYMax
Definition shapefil.h:401
double * padfX
Definition shapefil.h:390
double dfXMin
Definition shapefil.h:395
int * panPartType
Definition shapefil.h:387
double dfYMin
Definition shapefil.h:396
double * padfY
Definition shapefil.h:391
double dfMMax
Definition shapefil.h:403
double * padfZ
Definition shapefil.h:392
double dfZMax
Definition shapefil.h:402
double dfXMax
Definition shapefil.h:400
int * panPartStart
Definition shapefil.h:386
double * padfM
Definition shapefil.h:393
double dfMMin
Definition shapefil.h:398
double dfZMin
Definition shapefil.h:397
int bMeasureIsUsed
Definition shapefil.h:405