Is there a way to draw a PostgreSQL geometry in a PDF file using a PHP script?


Commercial solution is use FME to export data to 3d PDF, this one supports vector data.


I guess you can execute Gdal and ImageMagick from any language.

gdal_rasterize -b 1 -i -burn -9999 PG:'host=localhost dbname='unep''
               -sql "SELECT ST_buffer(the_geom, .12) 
                     from coastlines where name='Poland'" Poland_elev.tif

ImageMagick will convert a tiff to a pdf.


I use a php framework (CodeIgniter) in my apps which has a pdf library plugin to create the pdf document. Then I generate a url that calls my Mapserver WMS to get a map image of the appropriate size, features and use that url as an image tag (like: img src="url" ) in the pdf doc. It's a rather complicated solution, but it shows that it can be done and works well now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.