20 use,
INTRINSIC :: iso_c_binding
24 INTEGER,
PARAMETER :: lencharattr=40, nshp=4, tshp=shpt_polygonz
29 CHARACTER(len=1024) :: filename
31 INTEGER :: nshpr, tshpr, nfield, nrec, nd
32 REAL(kind=c_double) :: minbound(4), maxbound(4)
33 CHARACTER(len=lencharattr) :: charattrr
35 REAL(kind=c_double) :: doubleattrr
37 CALL getarg(1,filename)
38 IF (filename ==
'')
THEN 39 print
'(A)',
'Usage: shapelib_dump <shp_file>' 47 shphandle = shpopen(trim(filename),
'rb')
49 IF (shpfileisnull(shphandle) .OR. dbffileisnull(shphandle))
THEN 50 print*,
'Error opening ',trim(filename),
' for reading' 55 CALL shpgetinfo(shphandle, nshpr, tshpr, minbound, maxbound, nfield, nrec)
56 print*,
'number and type of shapes:',nshpr,tshpr
60 print*,
'Checking shape',i
62 shpobj = shpreadobject(shphandle, i)
64 IF (shpisnull(shpobj))
THEN 65 print*,
'Error in shpreadobject',i
71 print*,
'nvertices:',shpobj%nvertices
72 IF (
ASSOCIATED(shpobj%panpartstart))
THEN 73 print*,
'nparts:',
SIZE(shpobj%panpartstart)
74 print*,shpobj%panpartstart
79 CALL shpdestroyobject(shpobj)
84 CALL shpclose(shphandle)
87 END PROGRAM shapelib_dump
Object describing the geometrical properties of a shape.
Fortran 2003 interface to the shapelib http://shapelib.maptools.org/ library.
Object describing a shapefile dataset.