[postgis-users] pgsql2shp/shp2pgsql and php

Tyler Mitchell TMitchell at lignum.com
Thu Apr 1 09:01:58 PST 2004


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




More information about the postgis-users mailing list