[postgis-users] Can you call shp2pgsql from a c program ?

David.Jacques at CCRS.NRCan.gc.ca David.Jacques at CCRS.NRCan.gc.ca
Thu Nov 18 10:52:16 PST 2004


I'm developing some data loading routines in C/C++.
I'm able to call PQexec() with success for selection,
inserting, etc. However loading shapefiledata is another
question entirely. Is this even possible ? Is this a matter
of having a mappable cygwin drive visible ?

I should mention I am using MSVS.NET 7.0 compiler to
create win32 console apps (using ANSI c/c++ functionality only).


//get the .shp name from the unzipped file...
pShapeFileName = GetShapeFileName(pZipFileName);

//run the shape to postgis conversion program...
sprintf(command, "shp2pgsql -s 42304 %s xxmfirespots testdb >
%s.sql\n",pShapeFileName,pShapeFileName);
system(command);

'shp2pgsql' is not recognized as an internal or external command,operable
program or batch file.
shp2pgsql -s 42304 mire2004323.shp xxmfirespots testdb > mfire2004323shp.sql

feedback appreciated.

David Jacques



More information about the postgis-users mailing list