[postgis-users] pgsql2shp/shp2pgsql and php

Robert W. Burgholzer rburghol at vt.edu
Thu Apr 1 09:43:12 PST 2004


I do a good bit of file creation from php, and always use a directory that is 
writeable to apache for storing the output.

r.b.

>===== Original Message From Tyler Mitchell <TMitchell at lignum.com> =====
>Did you try running the script manually from a command line first to make
>sure it works?  Or are you running this through a web server who may not
>have permissions to execute pgsql2shp or write the output shapefile.  I
>assume you want to have a path to the pgsql2shp as well, though it appears
>that it is running.
>
>I would also recommend using ogr2ogr (from
>http://gdal.velocet.ca/projects/opengis/) which should allow you to
>convert directly from one postgis database to another (and I don't think
>it adds an extra GID column ;).
>
>Tyler
>
>postgis-users-bounces at postgis.refractions.net wrote on 04/01/2004 07:50:37
>AM:
>
>> thanks david!
>>
>> i tried this:
>>
>> <?php
>> $ret = shell_exec ("pgsql2shp -f <filename> -u <user> -g <geom_column>
>-h
>> <host> <dbname> <tablename> 2>&1");
>> echo $ret;
>> ?>
>>
>> and received the error message: could not create dbf file
>>
>> when running pgsql2shp from command line everything works fine but not
>from
>> within the php-script! i also tried the .sh-thing but the same result!
>any
>> ideas???
>>
>> stefan
>>
>>
>>
>>
>>
>> you should use from php
>> shell_exec("shp2pgsql ...");
>> or
>> shell_exec(pgsql2shp ..."),
>> or writing a shell (foo.sh) from php-script with in
>> foo.sh:
>> shp2pgsql ....
>> pgsql2shp ...
>> and do shell_exec(foo.sh)
>> I think this method could be improved :)
>>
>> --
>> +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz
>+++
>> 100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users

Robert W. Burgholzer
rburghol at veetee dot edu
History of Nutrition: "Buddha probably consumed a high-carb diet."




More information about the postgis-users mailing list