[Shapelib] Shapelib test
Frank Warmerdam
warmerdam at pobox.com
Mon Apr 27 20:21:33 PDT 2009
Jamie Lahowetz wrote:
> I am learning C so humor me. I have a simple script but everytime I run
> it I get a segmentation fault. Any ideas?
>
> #include <shapefil.h>
>
> int main (void)
> {
> const char * shapefile = "/mnt/share/uas/GRRUVI2_uc/
> extractor/colorado/fe_2007_08_county";
> SHPHandle handle;
> int entities;
> int type;
> double minbound;
> double maxbound;
>
> printf("%s\n", shapefile);
>
> handle = SHPOpen(shapefile,"rb");
> SHPGetInfo( handle,&entities,&type,&minbound,&maxbound);
>
> SHPClose(handle);
> return 0;
> }
Jamie,
The minbound and maxbound arguments need to be pointers to an array of
four values (for the four dimensions possible in a shapefile).
So more like:
...
double minbound[4];
double maxbound[4];
printf("%s\n", shapefile);
handle = SHPOpen(shapefile,"rb");
SHPGetInfo( handle,&entities,&type,minbound,maxbound);
...
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Shapelib
mailing list