GRASS 8 Programmer's Manual 8.5.0RC1(2026)-3334b87d9c
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 *
6 * Project: Shapelib
7 * Purpose: Primary include file for Shapelib.
8 * Author: Frank Warmerdam, warmerdam@pobox.com
9 *
10 ******************************************************************************
11 * Copyright (c) 1999, Frank Warmerdam
12 * Copyright (c) 2012-2024, Even Rouault <even dot rouault at spatialys.com>
13 *
14 * SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
15 ******************************************************************************
16 *
17 */
18
19#include <stdio.h>
20
21#ifdef USE_CPL
22#include "cpl_conv.h"
23#endif
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/************************************************************************/
30/* Version related macros (added in 1.6.0) */
31/************************************************************************/
32
33#define SHAPELIB_VERSION_MAJOR 1
34#define SHAPELIB_VERSION_MINOR 6
35#define SHAPELIB_VERSION_MICRO 2
36
37#define SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro) \
38 ((major) * 10000 + (minor) * 100 + (micro))
39
40#define SHAPELIB_VERSION_NUMBER \
41 SHAPELIB_MAKE_VERSION_NUMBER(SHAPELIB_VERSION_MAJOR, \
42 SHAPELIB_VERSION_MINOR, \
43 SHAPELIB_VERSION_MICRO)
44
45#define SHAPELIB_AT_LEAST(major, minor, micro) \
46 (SHAPELIB_VERSION_NUMBER >= \
47 SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro))
48
49/************************************************************************/
50/* Configuration options. */
51/************************************************************************/
52
53/* -------------------------------------------------------------------- */
54/* Should the DBFReadStringAttribute() strip leading and */
55/* trailing white space? */
56/* -------------------------------------------------------------------- */
57#define TRIM_DBF_WHITESPACE
58
59/* -------------------------------------------------------------------- */
60/* Should we write measure values to the Multipatch object? */
61/* Reportedly ArcView crashes if we do write it, so for now it */
62/* is disabled. */
63/* -------------------------------------------------------------------- */
64#define DISABLE_MULTIPATCH_MEASURE
65
66/* -------------------------------------------------------------------- */
67/* SHPAPI_CALL */
68/* */
69/* The following two macros are present to allow forcing */
70/* various calling conventions on the Shapelib API. */
71/* */
72/* To force __stdcall conventions (needed to call Shapelib */
73/* from Visual Basic and/or Delphi I believe) the makefile could */
74/* be modified to define: */
75/* */
76/* /DSHPAPI_CALL=__stdcall */
77/* */
78/* If it is desired to force export of the Shapelib API without */
79/* using the shapelib.def file, use the following definition. */
80/* */
81/* /DSHAPELIB_DLLEXPORT */
82/* */
83/* To get both at once it will be necessary to hack this */
84/* include file to define: */
85/* */
86/* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
87/* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
88/* */
89/* The complexity of the situation is partly caused by the */
90/* peculiar requirement of Visual C++ that __stdcall appear */
91/* after any "*"'s in the return value of a function while the */
92/* __declspec(dllexport) must appear before them. */
93/* -------------------------------------------------------------------- */
94
95#ifdef SHAPELIB_DLLEXPORT
96#define SHPAPI_CALL __declspec(dllexport)
97#define SHPAPI_CALL1(x) __declspec(dllexport) x
98#endif
99
100#ifndef SHPAPI_CALL
101#if defined(USE_GCC_VISIBILITY_FLAG)
102#define SHPAPI_CALL __attribute__((visibility("default")))
103#define SHPAPI_CALL1(x) __attribute__((visibility("default"))) x
104#else
105#define SHPAPI_CALL
106#endif
107#endif
108
109#ifndef SHPAPI_CALL1
110#define SHPAPI_CALL1(x) x SHPAPI_CALL
111#endif
112
113/* -------------------------------------------------------------------- */
114/* On some platforms, additional file IO hooks are defined that */
115/* UTF-8 encoded filenames Unicode filenames */
116/* -------------------------------------------------------------------- */
117#if defined(_WIN32)
118#define SHPAPI_WINDOWS
119#define SHPAPI_UTF8_HOOKS
120#endif
121
122/* -------------------------------------------------------------------- */
123/* IO/Error hook functions. */
124/* -------------------------------------------------------------------- */
125typedef int *SAFile;
126
127#ifndef SAOffset
128#if defined(_MSC_VER) && _MSC_VER >= 1400
129typedef unsigned __int64 SAOffset;
130#else
131typedef unsigned long SAOffset;
132#endif
133#endif
134
135typedef struct {
136 SAFile (*FOpen)(const char *filename, const char *access, void *pvUserData);
137 SAOffset (*FRead)(void *p, SAOffset size, SAOffset nmemb, SAFile file);
138 SAOffset (*FWrite)(const void *p, SAOffset size, SAOffset nmemb,
139 SAFile file);
140 SAOffset (*FSeek)(SAFile file, SAOffset offset, int whence);
144 int (*Remove)(const char *filename, void *pvUserData);
145
146 void (*Error)(const char *message);
147 double (*Atof)(const char *str);
149} SAHooks;
150
152#ifdef SHPAPI_UTF8_HOOKS
153void SHPAPI_CALL SASetupUtf8Hooks(SAHooks *psHooks);
154#endif
155
156/************************************************************************/
157/* SHP Support. */
158/************************************************************************/
159typedef struct tagSHPObject SHPObject;
160
161typedef struct {
163
166
167 int nShapeType; /* SHPT_* */
168
169 unsigned int nFileSize; /* SHP file */
170
173 unsigned int *panRecOffset;
174 unsigned int *panRecSize;
175
176 double adBoundsMin[4];
177 double adBoundsMax[4];
178
180
181 unsigned char *pabyRec;
183
185 unsigned char *pabyObjectBuf;
188} SHPInfo;
189
191
192typedef struct {
193 int year;
194 int month;
195 int day;
196} SHPDate;
197
198/* -------------------------------------------------------------------- */
199/* Shape types (nSHPType) */
200/* -------------------------------------------------------------------- */
201#define SHPT_NULL 0
202#define SHPT_POINT 1
203#define SHPT_ARC 3
204#define SHPT_POLYGON 5
205#define SHPT_MULTIPOINT 8
206#define SHPT_POINTZ 11
207#define SHPT_ARCZ 13
208#define SHPT_POLYGONZ 15
209#define SHPT_MULTIPOINTZ 18
210#define SHPT_POINTM 21
211#define SHPT_ARCM 23
212#define SHPT_POLYGONM 25
213#define SHPT_MULTIPOINTM 28
214#define SHPT_MULTIPATCH 31
215
216/* -------------------------------------------------------------------- */
217/* Part types - everything but SHPT_MULTIPATCH just uses */
218/* SHPP_RING. */
219/* -------------------------------------------------------------------- */
220
221#define SHPP_TRISTRIP 0
222#define SHPP_TRIFAN 1
223#define SHPP_OUTERRING 2
224#define SHPP_INNERRING 3
225#define SHPP_FIRSTRING 4
226#define SHPP_RING 5
227
228/* -------------------------------------------------------------------- */
229/* SHPObject - represents one shape (without attributes) read */
230/* from the .shp file. */
231/* -------------------------------------------------------------------- */
234
235 int nShapeId; /* -1 is unknown/unassigned */
236
240
242 double *padfX;
243 double *padfY;
244 double *padfZ;
245 double *padfM;
246
247 double dfXMin;
248 double dfYMin;
249 double dfZMin;
250 double dfMMin;
251
252 double dfXMax;
253 double dfYMax;
254 double dfZMax;
255 double dfMMax;
256
259};
260
261/* -------------------------------------------------------------------- */
262/* SHP API Prototypes */
263/* -------------------------------------------------------------------- */
264
265/* If pszAccess is read-only, the fpSHX field of the returned structure */
266/* will be NULL as it is not necessary to keep the SHX file open */
267SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess);
268SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess,
269 const SAHooks *psHooks);
270SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile,
271 const char *pszAccess, const SAHooks *psHooks,
272 int bRestoreSHX);
273
274int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess,
275 const SAHooks *psHooks);
276
277/* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the
278 * SHPHandle. */
279/* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
280/* The SHPObject padfZ and padfM members may be NULL depending on the geometry
281 */
282/* type. It is illegal to free at hand any of the pointer members of the
283 * SHPObject structure */
284void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode);
285
286SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType);
287SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType,
288 const SAHooks *psHooks);
289void SHPAPI_CALL SHPGetInfo(const SHPHandle hSHP, int *pnEntities,
290 int *pnShapeType, double *padfMinBound,
291 double *padfMaxBound);
292
293SHPObject SHPAPI_CALL1(*) SHPReadObject(const SHPHandle hSHP, int iShape);
294int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape,
295 const SHPObject *psObject);
296
300 SHPCreateObject(int nSHPType, int nShapeId, int nParts,
301 const int *panPartStart, const int *panPartType,
302 int nVertices, const double *padfX, const double *padfY,
303 const double *padfZ, const double *padfM);
305 SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX,
306 const double *padfY, const double *padfZ);
307
308int SHPAPI_CALL SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject);
309
312
313const char SHPAPI_CALL1(*) SHPTypeName(int nSHPType);
314const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType);
315
316/* -------------------------------------------------------------------- */
317/* Shape quadtree indexing API. */
318/* -------------------------------------------------------------------- */
319
320/* this can be two or four for binary or quad tree */
321#define MAX_SUBNODE 4
322
323/* upper limit of tree levels for automatic estimation */
324#define MAX_DEFAULT_TREE_DEPTH 12
325
326typedef struct shape_tree_node {
327 /* region covered by this node */
328 double adfBoundsMin[4];
329 double adfBoundsMax[4];
330
331 /* list of shapes stored at this node. The papsShapeObj pointers
332 or the whole list can be NULL */
336
339
341
351
353 SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth,
354 const double *padfBoundsMin, const double *padfBoundsMax);
356
357int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename);
358
360
362
363int SHPAPI_CALL1(*)
364 SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin,
365 double *padfBoundsMax, int *);
366int SHPAPI_CALL SHPCheckBoundsOverlap(const double *, const double *,
367 const double *, const double *, int);
368
369int SHPAPI_CALL1(*) SHPSearchDiskTree(FILE *fp, double *padfBoundsMin,
370 double *padfBoundsMax, int *pnShapeCount);
371
372typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;
373
375 const SAHooks *psHooks);
376
378
379int SHPAPI_CALL1(*)
381 double *padfBoundsMin, double *padfBoundsMax,
382 int *pnShapeCount);
383
384int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename,
385 const SAHooks *psHooks);
386
387/* -------------------------------------------------------------------- */
388/* SBN Search API */
389/* -------------------------------------------------------------------- */
390
391typedef struct SBNSearchInfo *SBNSearchHandle;
392
393SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename,
394 const SAHooks *psHooks);
395
397
398int SHPAPI_CALL1(*)
399 SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin,
400 const double *padfBoundsMax, int *pnShapeCount);
401
402int SHPAPI_CALL1(*)
403 SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY,
404 int bMaxX, int bMaxY, int *pnShapeCount);
405
406void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId);
407
408/************************************************************************/
409/* DBF Support. */
410/************************************************************************/
411typedef struct DBFInfo {
413
415
417
418 int nRecordLength; /* Must fit on uint16 */
419 int nHeaderLength; /* File header length (32) + field
420 descriptor length + spare space.
421 Must fit on uint16 */
427
428 char *pszHeader; /* Field descriptors */
429
433
436
439
440 union {
443 } fieldValue;
444
447
448 int nUpdateYearSince1900; /* 0-255 */
449 int nUpdateMonth; /* 1-12 */
450 int nUpdateDay; /* 1-31 */
451
452 int bWriteEndOfFileChar; /* defaults to TRUE */
453
456
457typedef struct DBFInfo *DBFHandle;
458
467
468/* Field descriptor/header size */
469#define XBASE_FLDHDR_SZ 32
470/* Shapelib read up to 11 characters, even if only 10 should normally be used */
471#define XBASE_FLDNAME_LEN_READ 11
472/* On writing, we limit to 10 characters */
473#define XBASE_FLDNAME_LEN_WRITE 10
474/* Normally only 254 characters should be used. We tolerate 255 historically */
475#define XBASE_FLD_MAX_WIDTH 255
476
477DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess);
478DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess,
479 const SAHooks *psHooks);
480DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile);
481DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile,
482 const char *pszCodePage);
483DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile,
484 const char *pszCodePage,
485 const SAHooks *psHooks);
486
487int SHPAPI_CALL DBFGetFieldCount(const DBFHandle psDBF);
489int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName,
490 DBFFieldType eType, int nWidth, int nDecimals);
491
492int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName,
493 char chType, int nWidth, int nDecimals);
494
495int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField);
496
497int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, const int *panMap);
498
499int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField,
500 const char *pszFieldName, char chType,
501 int nWidth, int nDecimals);
502
503DBFFieldType SHPAPI_CALL DBFGetFieldInfo(const DBFHandle psDBF, int iField,
504 char *pszFieldName, int *pnWidth,
505 int *pnDecimals);
506
508 const char *pszFieldName);
509
510int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField);
511double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape,
512 int iField);
513const char SHPAPI_CALL1(*)
514 DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);
515const char SHPAPI_CALL1(*)
516 DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField);
518 int iField);
519int SHPAPI_CALL DBFIsAttributeNULL(const DBFHandle hDBF, int iShape,
520 int iField);
521
522int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField,
523 int nFieldValue);
524int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField,
525 double dFieldValue);
526int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField,
527 const char *pszFieldValue);
528int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField);
529
530int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField,
531 const char lFieldValue);
532int SHPAPI_CALL DBFWriteDateAttribute(DBFHandle hDBF, int iShape, int iField,
533 const SHPDate *dateFieldValue);
534int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity,
535 int iField, const void *pValue);
536const char SHPAPI_CALL1(*) DBFReadTuple(DBFHandle psDBF, int hEntity);
537int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity,
538 const void *pRawTuple);
539
540int SHPAPI_CALL DBFIsRecordDeleted(const DBFHandle psDBF, int iShape);
541int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape,
542 int bIsDeleted);
543
545 const char *pszFilename);
546
549char SHPAPI_CALL DBFGetNativeFieldType(const DBFHandle hDBF, int iField);
550
551const char SHPAPI_CALL1(*) DBFGetCodePage(const DBFHandle psDBF);
552
553void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900,
554 int nMM, int nDD);
555
556void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag);
557
558#ifdef __cplusplus
559}
560#endif
561
562#endif /* ndef SHAPEFILE_H_INCLUDED */
DBFHandle DBFCloneEmpty(const DBFHandle psDBF, const char *pszFilename)
Definition dbfopen.c:1680
const char * DBFGetCodePage(const DBFHandle psDBF)
Definition dbfopen.c:1834
int DBFWriteIntegerAttribute(DBFHandle psDBF, int iRecord, int iField, int nValue)
Definition dbfopen.c:1533
const char * DBFReadTuple(DBFHandle psDBF, int hEntity)
Definition dbfopen.c:1662
int DBFWriteStringAttribute(DBFHandle psDBF, int iRecord, int iField, const char *pszValue)
Definition dbfopen.c:1548
int DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
Definition dbfopen.c:1800
int DBFWriteLogicalAttribute(DBFHandle psDBF, int iRecord, int iField, const char lValue)
Definition dbfopen.c:1573
void DBFClose(DBFHandle psDBF)
Definition dbfopen.c:568
int DBFWriteNULLAttribute(DBFHandle psDBF, int iRecord, int iField)
Definition dbfopen.c:1562
SHPDate DBFReadDateAttribute(DBFHandle psDBF, int iRecord, int iField)
Definition dbfopen.c:1146
int DBFIsRecordDeleted(const DBFHandle psDBF, int iShape)
Definition dbfopen.c:1776
void DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
Definition dbfopen.c:2357
int DBFIsAttributeNULL(const DBFHandle psDBF, int iRecord, int iField)
Definition dbfopen.c:1235
const char * DBFReadLogicalAttribute(DBFHandle psDBF, int iRecord, int iField)
Definition dbfopen.c:1134
int DBFWriteDoubleAttribute(DBFHandle psDBF, int iRecord, int iField, double dValue)
Definition dbfopen.c:1520
void DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
Definition dbfopen.c:286
void DBFUpdateHeader(DBFHandle psDBF)
Definition dbfopen.c:252
char DBFGetNativeFieldType(const DBFHandle psDBF, int iField)
Definition dbfopen.c:1740
int DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, const void *pValue)
Definition dbfopen.c:1451
const char * DBFReadStringAttribute(DBFHandle psDBF, int iRecord, int iField)
Definition dbfopen.c:1121
int DBFWriteDateAttribute(DBFHandle psDBF, int iRecord, int iField, const SHPDate *lValue)
Definition dbfopen.c:1587
int DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple)
Definition dbfopen.c:1611
#define file
int SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
int * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
void SHPDestroyObject(SHPObject *psObject)
Definition shpopen.c:2725
SHPObject * SHPReadObject(const SHPHandle hSHP, int iShape)
Definition shpopen.c:1852
DBFFieldType
Definition shapefil.h:459
@ FTDouble
Definition shapefil.h:462
@ FTString
Definition shapefil.h:460
@ FTInvalid
Definition shapefil.h:465
@ FTLogical
Definition shapefil.h:463
@ FTDate
Definition shapefil.h:464
@ FTInteger
Definition shapefil.h:461
int DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition dbfopen.c:795
DBFHandle DBFOpenLL(const char *pszDBFFile, const char *pszAccess, const SAHooks *psHooks)
Definition dbfopen.c:331
int * SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *)
int DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
Definition dbfopen.c:751
void SHPClose(SHPHandle hSHP)
Definition shpopen.c:851
int SHPCheckBoundsOverlap(const double *, const double *, const double *, const double *, int)
SHPHandle SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks, int bRestoreSHX)
Definition shpopen.c:602
struct shape_tree_node SHPTreeNode
int DBFGetFieldCount(const DBFHandle psDBF)
Definition dbfopen.c:1253
SHPObject * 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)
Definition shpopen.c:1180
SHPObject * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ)
Definition shpopen.c:1309
void SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
int SHPWriteObject(SHPHandle hSHP, int iShape, const SHPObject *psObject)
Definition shpopen.c:1323
#define MAX_SUBNODE
Definition shapefil.h:321
void SBNCloseDiskTree(SBNSearchHandle hSBN)
void SHPDestroyTree(SHPTree *hTree)
int DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition dbfopen.c:2109
struct SHPDiskTreeInfo * SHPTreeDiskHandle
Definition shapefil.h:372
SHPTreeDiskHandle SHPOpenDiskTree(const char *pszQIXFilename, const SAHooks *psHooks)
SHPHandle SHPOpenLL(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
Definition shpopen.c:251
void SHPWriteHeader(SHPHandle hSHP)
Definition shpopen.c:62
int DBFDeleteField(DBFHandle hDBF, int iField)
Definition dbfopen.c:1847
SBNSearchHandle SBNOpenDiskTree(const char *pszSBNFilename, const SAHooks *psHooks)
void SBNSearchFreeIds(int *panShapeId)
SHPTree * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, const double *padfBoundsMin, const double *padfBoundsMax)
DBFFieldType DBFGetFieldInfo(const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
Definition dbfopen.c:1277
int DBFReorderFields(DBFHandle psDBF, const int *panMap)
Definition dbfopen.c:1972
const char * SHPTypeName(int nSHPType)
Definition shpopen.c:2641
int * SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
int DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
Definition dbfopen.c:1084
SHPInfo * SHPHandle
Definition shapefil.h:190
DBFHandle DBFCreate(const char *pszDBFFile)
Definition dbfopen.c:616
SHPHandle SHPOpen(const char *pszShapeFile, const char *pszAccess)
Definition shpopen.c:219
DBFHandle DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, const SAHooks *psHooks)
Definition dbfopen.c:643
int SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, const SAHooks *psHooks)
int * SAFile
Definition shapefil.h:125
void SHPTreeTrimExtraNodes(SHPTree *hTree)
double DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
Definition dbfopen.c:1102
void SHPGetInfo(const SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
Definition shpopen.c:916
#define SHPAPI_CALL
Definition shapefil.h:105
DBFHandle DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
Definition dbfopen.c:627
void SASetupDefaultHooks(SAHooks *psHooks)
Definition safileio.c:91
#define SHPAPI_CALL1(x)
Definition shapefil.h:110
struct SBNSearchInfo * SBNSearchHandle
Definition shapefil.h:391
int SHPWriteTree(SHPTree *hTree, const char *pszFilename)
struct DBFInfo * DBFHandle
Definition shapefil.h:457
struct tagSHPObject SHPObject
Definition shapefil.h:159
int SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject)
Definition shpopen.c:2856
DBFHandle DBFOpen(const char *pszDBFFile, const char *pszAccess)
Definition dbfopen.c:300
int SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
Definition shpopen.c:623
int * SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin, const double *padfBoundsMax, int *pnShapeCount)
int * SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount)
const char * SHPPartTypeName(int nPartType)
Definition shpopen.c:2695
void SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
Definition shpopen.c:897
void SHPComputeExtents(SHPObject *psObject)
Definition shpopen.c:1147
int DBFGetRecordCount(const DBFHandle psDBF)
Definition dbfopen.c:1264
int DBFGetFieldIndex(const DBFHandle psDBF, const char *pszFieldName)
Definition dbfopen.c:1756
unsigned long SAOffset
Definition shapefil.h:131
SHPHandle SHPCreateLL(const char *pszShapeFile, int nShapeType, const SAHooks *psHooks)
Definition shpopen.c:960
SHPHandle SHPCreate(const char *pszShapeFile, int nShapeType)
Definition shpopen.c:944
int nUpdateDay
Definition shapefil.h:450
int bWriteEndOfFileChar
Definition shapefil.h:452
int nRecordLength
Definition shapefil.h:418
int * panFieldOffset
Definition shapefil.h:423
int * panFieldDecimals
Definition shapefil.h:425
char * pszCodePage
Definition shapefil.h:446
int nUpdateMonth
Definition shapefil.h:449
int nFields
Definition shapefil.h:422
int bUpdated
Definition shapefil.h:438
int nHeaderLength
Definition shapefil.h:419
int * panFieldSize
Definition shapefil.h:424
char * pszCurrentRecord
Definition shapefil.h:432
int bCurrentRecordModified
Definition shapefil.h:431
char * pszHeader
Definition shapefil.h:428
int nUpdateYearSince1900
Definition shapefil.h:448
SAFile fp
Definition shapefil.h:414
char * pachFieldType
Definition shapefil.h:426
int bRequireNextWriteSeek
Definition shapefil.h:454
int nWorkFieldLength
Definition shapefil.h:434
SAHooks sHooks
Definition shapefil.h:412
int bNoHeader
Definition shapefil.h:437
int iLanguageDriver
Definition shapefil.h:445
int nRecords
Definition shapefil.h:416
char * pszWorkField
Definition shapefil.h:435
double dfDoubleField
Definition shapefil.h:441
int nIntField
Definition shapefil.h:442
int nCurrentRecord
Definition shapefil.h:430
void(* Error)(const char *message)
Definition shapefil.h:146
SAOffset(* FTell)(SAFile file)
Definition shapefil.h:141
int(* FFlush)(SAFile file)
Definition shapefil.h:142
SAFile(* FOpen)(const char *filename, const char *access, void *pvUserData)
Definition shapefil.h:136
double(* Atof)(const char *str)
Definition shapefil.h:147
void * pvUserData
Definition shapefil.h:148
SAOffset(* FWrite)(const void *p, SAOffset size, SAOffset nmemb, SAFile file)
Definition shapefil.h:138
int(* FClose)(SAFile file)
Definition shapefil.h:143
int(* Remove)(const char *filename, void *pvUserData)
Definition shapefil.h:144
SAOffset(* FRead)(void *p, SAOffset size, SAOffset nmemb, SAFile file)
Definition shapefil.h:137
SAOffset(* FSeek)(SAFile file, SAOffset offset, int whence)
Definition shapefil.h:140
int day
Definition shapefil.h:195
int month
Definition shapefil.h:194
int year
Definition shapefil.h:193
SAFile fpSHX
Definition shapefil.h:165
int nShapeType
Definition shapefil.h:167
SAFile fpSHP
Definition shapefil.h:164
int nMaxRecords
Definition shapefil.h:172
SHPObject * psCachedObject
Definition shapefil.h:187
int nBufSize
Definition shapefil.h:182
unsigned int * panRecSize
Definition shapefil.h:174
SAHooks sHooks
Definition shapefil.h:162
double adBoundsMin[4]
Definition shapefil.h:176
int nRecords
Definition shapefil.h:171
unsigned char * pabyObjectBuf
Definition shapefil.h:185
int bUpdated
Definition shapefil.h:179
int nObjectBufSize
Definition shapefil.h:186
unsigned int nFileSize
Definition shapefil.h:169
unsigned int * panRecOffset
Definition shapefil.h:173
int bFastModeReadObject
Definition shapefil.h:184
unsigned char * pabyRec
Definition shapefil.h:181
double adBoundsMax[4]
Definition shapefil.h:177
SHPTreeNode * psRoot
Definition shapefil.h:349
SHPHandle hSHP
Definition shapefil.h:343
int nDimension
Definition shapefil.h:346
int nMaxDepth
Definition shapefil.h:345
int nTotalCount
Definition shapefil.h:347
SHPObject ** papsShapeObj
Definition shapefil.h:335
int * panShapeIds
Definition shapefil.h:334
struct shape_tree_node * apsSubNode[4]
Definition shapefil.h:338
double adfBoundsMax[4]
Definition shapefil.h:329
double adfBoundsMin[4]
Definition shapefil.h:328
int bFastModeReadObject
Definition shapefil.h:258
double dfYMax
Definition shapefil.h:253
double * padfX
Definition shapefil.h:242
double dfXMin
Definition shapefil.h:247
int * panPartType
Definition shapefil.h:239
double dfYMin
Definition shapefil.h:248
double * padfY
Definition shapefil.h:243
double dfMMax
Definition shapefil.h:255
double * padfZ
Definition shapefil.h:244
double dfZMax
Definition shapefil.h:254
double dfXMax
Definition shapefil.h:252
int * panPartStart
Definition shapefil.h:238
double * padfM
Definition shapefil.h:245
double dfMMin
Definition shapefil.h:250
double dfZMin
Definition shapefil.h:249
int bMeasureIsUsed
Definition shapefil.h:257