[FWTools] calling ogr2ogr from PHP shell_exec with upper-case Postgres field names

Kidd, David M d.kidd at imperial.ac.uk
Thu May 19 04:40:50 EST 2011


I am trying to export spatial data from a Postgres/PostGIS table with upper-case field names by calling ogr2ogr from PHP shell_exec(). I am currently working on a Windows XP machine, but also need to port to LINUX.

I  know I have to escape double qoutes, but have so far have not worked out how to do this correctly.

The following works at the command line but fails when called with PHP shell_exec()

"C:\FWTools2.4.7\bin\ogr2ogr" -f "ESRI Shapefile" test.shp PG:"<connect_str>" -sql "SELECT * FROM gpdd.location_pt WHERE \"LocationID\" = ANY(Array[1,2,3])"

I have tried escaping the slashes with one or two preceeding shashes but to no avail.

Any suggestions greatly appreciated. Thanks,

 - Dave

David M. Kidd

Research Associate
Center for Population Biology
Silwood Park Campus
Imperial College London
0207 594 2470

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20110519/de45629d/attachment.htm 

More information about the FWTools mailing list