[mapserver-users] PDF output with layers

Andy Colson andy at squeakycode.net
Mon Sep 4 07:33:03 PDT 2017


On 09/04/2017 09:20 AM, Carlos Ruiz wrote:
> I'm currently exploring PDF generation from Mapserver and I have noticed that no layers appear to be toggled. First I thought this was because the layer CLASS section has no name (as it happens when legend is generated), but it is not.
> 
> gdalinfo test.pdf does not show layers information.
> 
> Does anybody know how to configure a MAP file to include layers in the PDF output ?
> 
> Here is test.map contents:
> 
> MAP
> 
>      NAME "test"
>      EXTENT 657024 2277645 687240 2294128
>      SIZE 800 600
> 
>      OUTPUTFORMAT
>          NAME "pdf"
>          DRIVER CAIRO/PDF
>          MIMETYPE "application/x-pdf"
>          IMAGEMODE RGB
>          EXTENSION "pdf"
>          FORMATOPTION "GEO_ENCODING=ISO32000"
>      END
> 
>      PROJECTION
>          "init=EPSG:32613"
>      END
> 
>      STATUS ON
> 
>      LAYER
>          NAME "Landsat 8"
>          CONNECTION "http://localhost/cgi-bin/landsat8.exe"
>          CONNECTIONTYPE WMS
>          TYPE RASTER
>          STATUS ON
>          METADATA
>              "wms_name" "Landsat 8"
>              "wms_srs" "EPSG:32613"
>              "wms_server_version" "1.0.0"
>              "wms_format" "image/jpeg"
>          END
>      END
> 
>      LAYER
>          NAME "Colonias"
>          CONNECTION "..."
>          CONNECTIONTYPE POSTGIS
>          DATA "geom FROM colonias_amg"
>          TYPE POLYGON
>          CLASS
>              NAME "Colonias"
>              STYLE
>                  COLOR 255 200 150
>                  OUTLINECOLOR 0 0 0
>              END
>          END
>          COMPOSITE
>              OPACITY 35
>          END
>          STATUS ON
>      END
> 
> END
> 
> Thanks in advance
> 


How does the pdf look?  Is it empty?

This page:
http://www.gdal.org/frmt_pdf.html

shows the example:

> gdalinfo adobe_style_geospatial.pdf -mdd LAYERS


Does the extra "-mdd LAYERS" help?

Looks like you need GDAL 1.9 or above, what are you on?

-Andy



More information about the MapServer-users mailing list