16#ifndef _SHAPEREADER_SHP_H
17#define _SHAPEREADER_SHP_H
118 size_t (*fread)(
struct shp_file_t *fh,
void *buf,
size_t count);
124 int (*fsetpos)(
struct shp_file_t *fh,
size_t offset);
157 __attribute__((format(printf, 2, 3)));
int shp_read(shp_file_t *fh, shp_header_callback_t handle_header, shp_record_callback_t handle_record)
Read a shape file.
Definition: shp.c:901
int(* shp_header_callback_t)(shp_file_t *fh, const shp_header_t *header)
Handle the file header.
Definition: shp.h:173
void shp_set_error(shp_file_t *fh, const char *format,...)
Set an error message.
Definition: shp.c:74
int shp_read_header(shp_file_t *fh, shp_header_t *header)
Read the file header.
Definition: shp.c:87
int(* shp_record_callback_t)(shp_file_t *fh, const shp_header_t *header, const shp_record_t *record, size_t file_offset)
Handle a record.
Definition: shp.h:189
int shp_read_record(shp_file_t *fh, shp_record_t **precord)
Read a record.
Definition: shp.c:849
shp_type_t
Shape types.
Definition: shp.h:38
@ SHP_TYPE_MULTIPOINT
Set of Points.
Definition: shp.h:43
@ SHP_TYPE_POINTZ
PointZ with X, Y, Z, M coordinates.
Definition: shp.h:44
@ SHP_TYPE_MULTIPOINTZ
Set of PointZs.
Definition: shp.h:47
@ SHP_TYPE_NULL
Null shape without geometric data.
Definition: shp.h:39
@ SHP_TYPE_POLYLINEM
PolyLineM with X, Y, M coordinates.
Definition: shp.h:49
@ SHP_TYPE_POINTM
PointM with X, Y, M coordinates.
Definition: shp.h:48
@ SHP_TYPE_POLYLINE
PolyLine with X, Y coordinates.
Definition: shp.h:41
@ SHP_TYPE_POINT
Point with X, Y coordinates.
Definition: shp.h:40
@ SHP_TYPE_POLYGON
Polygon with X, Y coordinates.
Definition: shp.h:42
@ SHP_TYPE_POLYGONM
PolygonM with X, Y, M coordinates.
Definition: shp.h:50
@ SHP_TYPE_POLYLINEZ
PolyLineZ with X, Y, Z, M coordinates.
Definition: shp.h:45
@ SHP_TYPE_MULTIPOINTM
Set of PointMs.
Definition: shp.h:51
@ SHP_TYPE_POLYGONZ
PolygonZ with X, Y, Z, M coordinates.
Definition: shp.h:46
@ SHP_TYPE_MULTIPATCH
Complex surfaces.
Definition: shp.h:52
shp_file_t * shp_init_file(shp_file_t *fh, FILE *stream, void *user_data)
Initialize a file handle.
Definition: shp.c:56
int shp_seek_record(shp_file_t *fh, size_t file_offset, shp_record_t **precord)
Read a record at a particular file position.
Definition: shp.c:870
File handle.
Definition: shp.h:114
size_t num_bytes
Number of bytes read.
Definition: shp.h:128
void * user_data
Callback data.
Definition: shp.h:126
char error[128]
Error message.
Definition: shp.h:130
MultiPatch.
Definition: shp-multipatch.h:66
MultiPoint.
Definition: shp-multipoint.h:27
MultiPointM.
Definition: shp-multipointm.h:28
MultiPointZ.
Definition: shp-multipointz.h:28
Point.
Definition: shp-point.h:24
PointM.
Definition: shp-pointm.h:25
PointZ.
Definition: shp-pointz.h:25
Polygon.
Definition: shp-polygon.h:30
PolygonM.
Definition: shp-polygonm.h:29
PolygonZ.
Definition: shp-polygonz.h:29
PolyLine.
Definition: shp-polyline.h:29
PolyLineM.
Definition: shp-polylinem.h:29
PolyLineZ.
Definition: shp-polylinez.h:29
Record.
Definition: shp.h:77
shp_multipointm_t multipointm
Set of PointMs if type is SHP_TYPE_MULTIPOINTM.
Definition: shp.h:91
shp_multipatch_t multipatch
MultiPatch if type is SHP_TYPE_MULTIPATCH.
Definition: shp.h:107
shp_polylinem_t polylinem
PolyLineM if type is SHP_TYPE_POLYLINEM.
Definition: shp.h:97
shp_multipointz_t multipointz
Set of PointZs if type is SHP_TYPE_MULTIPOINTZ.
Definition: shp.h:93
shp_multipoint_t multipoint
Set of Points if type is SHP_TYPE_MULTIPOINT.
Definition: shp.h:89
size_t record_size
Content length in bytes.
Definition: shp.h:79
shp_point_t point
Point if type is SHP_TYPE_POINT.
Definition: shp.h:83
shp_polygon_t polygon
Polygon if type is SHP_TYPE_POLYGON.
Definition: shp.h:101
shp_pointm_t pointm
PointM if type is SHP_TYPE_POINTM.
Definition: shp.h:85
shp_polygonm_t polygonm
PolygonM if type is SHP_TYPE_POLYGONM.
Definition: shp.h:103
shp_polygonz_t polygonz
PolygonZ if type is SHP_TYPE_POLYGONZ.
Definition: shp.h:105
shp_polylinez_t polylinez
PolyLineZ if type is SHP_TYPE_POLYLINEZ.
Definition: shp.h:99
size_t record_number
Record number (beginning at 1)
Definition: shp.h:78
shp_type_t type
Shape type.
Definition: shp.h:80
shp_polyline_t polyline
PolyLine if type is SHP_TYPE_POLYLINE.
Definition: shp.h:95
shp_pointz_t pointz
PointZ if type is SHP_TYPE_POINTZ.
Definition: shp.h:87