Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to draw a postgres geometry in a pdf file using a php script? Thank you.

share|improve this question

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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