<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 06/02/2014 19:31, Larry Shaffer
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA+nQOR-8eTn2pE7wrMQpPkokwJ+s2Ks3qQubnUwHxi=UcrtVRQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Hugo,<br>
        <div>
          <div class="gmail_extra"><br>
            <div class="gmail_quote">On Thu, Feb 6, 2014 at 6:24 AM,
              Hugo Mercier <span dir="ltr"><<a
                  moz-do-not-send="true"
                  href="mailto:hugo.mercier@oslandia.com"
                  target="_blank">hugo.mercier@oslandia.com</a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">Hi,<br>
                <br>
                I am investigating how multilayer PDF export could be
                handled through QGIS.<br>
                This is a feature of the PDF format (called Optional
                Content Groups)<br>
                that would allow to keep "layered" representation of a
                GIS map when<br>
                exported to a PDF.<br>
                <br>
                Something similar has been recently done with the SVG
                format (<br>
                <a moz-do-not-send="true"
                  href="https://github.com/qgis/QGIS/pull/1092"
                  target="_blank">https://github.com/qgis/QGIS/pull/1092</a>)<br>
                <br>
                As far as I know :<br>
                - QPrinter/QPainter is not able to deal with this
                concept of layer<br>
                - OGR/GDAL has a driver for Geospatial PDF writing that
                does support<br>
                multi layers, but has a very limited support for
                styling, so it would<br>
                require to rasterize each layer and put them into the
                PDF<br>
                - only a few third-party PDF libraries support writing
                and OCG, probably<br>
                poppler is the best option.<br>
                <br>
                Does anyone see other easier options ?<br>
              </blockquote>
              <div><br>
                What about generating individual PDF outputs for each
                'layer' (i.e. a layer or group of layers in layer
                legend) first, then combining them into a PDF as layers?<br>
                <br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    The code to generate multi-layered svg can be used for that. What
    the code does is to hide all/show one composer items or map layer at
    a time and render it to a stream, the stream is then post-process
    (in case of svg it's an xml structure) to create the final output.<br>
    <br>
    It would be a nice refactoring to have the same (templated?)
    function to do both. <br>
    <br>
    <blockquote
cite="mid:CA+nQOR-8eTn2pE7wrMQpPkokwJ+s2Ks3qQubnUwHxi=UcrtVRQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div class="gmail_extra">
            <div class="gmail_quote">
              <div>This is totally untested, but when using GDAL to
                generate a geospatial, layered PDF, could the individual
                'layer' PDF outputs be piped back into GDAL as
                DATASOURCEs for individual layers? There seems to be a
                set order for generating the layers, e.g. raster on
                bottom with vector layers over top, instead of random
                instertion, e.g. raster on bottom, then vector, then
                raster. You might want to ask Mr. Warmerdam about how
                flexible the PDF layer writing process is, and whether
                external PDF content can be streamed through to layered
                output (instead of having any geometries read and
                styled). There is the EXTRA_STREAM=content creation
                option, but I don't know if it can be used multiple
                times to insert external PDFs as layers.<br>
                <br>
              </div>
              <div>Also, I think the blending modes of individual
                layers/groups would have to be migrated to PDF-specific
                (Postcript?) definitions, since each will be rendered
                separately. Surely standard blending modes for layers
                can be defined in PDFs (?).<br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <blockquote
cite="mid:CA+nQOR-8eTn2pE7wrMQpPkokwJ+s2Ks3qQubnUwHxi=UcrtVRQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div class="gmail_extra">
            <div class="gmail_quote">
              <div>
                <br>
              </div>
              <div>I think this is a *very* important export feature to
                add to QGIS, and will ultimately help with its adoption
                in enterprise, institutional and government settings,
                since such an output fulfills many mandates for publicly
                releasing a functional representation of data.<br>
              </div>
              <div><br>
              </div>
              <div>Regards,<br>
                <br>
              </div>
              <div>Larry<br>
              </div>
              <div><br>
                 </div>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                Thanks !<br>
                <span class=""><font color="#888888">--<br>
                    Hugo Mercier<br>
                    Oslandia<br>
                    _______________________________________________<br>
                    Qgis-developer mailing list<br>
                    <a moz-do-not-send="true"
                      href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
                    <a moz-do-not-send="true"
                      href="http://lists.osgeo.org/mailman/listinfo/qgis-developer"
                      target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
                  </font></span></blockquote>
            </div>
            <br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Qgis-developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
    </blockquote>
    <br>
  </body>
</html>