[QGIS-Developer] QGIS enhancement: export to GeoPDF

Even Rouault even.rouault at spatialys.com
Thu Jul 5 06:16:28 PDT 2018


> > vector components.
> I like this idea of "hybrid" vector/raster layers (both types in one
> layer). I am aware that the file-size would be bloated. But on the other
> hand for some layer styles compression would work very well.
> 
> In an ideal world, QGIS could examine layer styles and decide what could
> be exported as vectors only, because the style, e.g. is only simple
> fills and strokes and what layer styles would have to be rasterized.

Could be an option indeed

> 
> The other open question is what would happen with labels - would they be
> rasterized as well?

Text rendering is rather difficult in PDF, and the GDAL PDF driver only 
supports super minimalistic rendering of it (Latin1 characters only), so yes, 
labels would have to be rasterized

> What about layer hierarchy? QGIS always draws labels
> on top of any other layer, but PDF does not ...

You could create a separate PDF layer hiearchy with (rasterized) labels only 
that would be drawn in last.

Actually you don't need to create separate PDF layers. In PDF, there is a main 
drawing stream, that is followed sequentially, and in that stream, you can tag 
objects as belonging to some layer, so you could possibly have a drawing 
stream like the following where text are drawn in last (that's more or less 
what the GDAL PDF writer currently does when it is rendering text itself)

always drawn background raster
<raster_layer>
	raster image
</raster_layer>
<vector_layer_1>
	vector content of layer 1 (rasterized with transparency)
</vector_layer_1>
<vector_layer_2>
	vector content of layer 2 (rasterized with transparency)
</vector_layer_2>
<vector_layer_1>
	labels of layer 1 (rasterized with transparency)
</vector_layer_1>
<vector_layer_2>
	labels of layer 2 (rasterized with transparency)
</vector_layer_2>

> agreed this is yet another issue we would come across. I wonder what
> ArcGIS/Geomedia is doing in such cases?

I have seen a number of ESRI generated geospatial PDFs, that have PDF layers, 
part of them raster only, others vectors only, but the vector content was just 
drawing not using the 'structured vector' capabilities.

I have one sample though where the vector objects are using structured vector. 
Interestigly when identifying a punctual symbol, the 'ghost' that is drawn to 
mark the selection is a square approximately located at the drawing, so it is 
likely that they use the approach you suggested: they don't necessarily 
rasterize the vector, but the vector drawings aren't necessarily the same as 
the vector identifiable objects. As on attached screenshot, where you can see 
the red ghost square that reprents the selection made by the 'Object data 
tool' and on the left the corresponding attributes, but it is roughly 
positionned with respect to the actual black symbol of the cemetery.

> 
> Even - would you be interested in working on this - perhaps together
> with another QGIS dev who knows QGIS rendering internals very well?

Possibly yes. There is a clear boundary between the GDAL side and the QGIS 
side.

Even


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot.png
Type: image/png
Size: 19942 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180705/823132a4/attachment-0001.png>


More information about the QGIS-Developer mailing list