[gdal-dev] Geospatial PDF with OGR_DATASOURCE

Even Rouault even.rouault at mines-paris.org
Mon Jun 4 13:37:23 PDT 2012


> 
> I made some quick trials by combining some raster base maps and
> shapefiles and I am sure that this will be an amusing toy. But
> with the default settings the vector features are almost invisible
> on the map because of the drawing styles. I made a blind
> trial with OGR Feature Styles and wrote these two lines into a
> .ofs file for making linework a bit wider
> 	OFS-version 1.0
> 	DefaultStyle: PEN(c:#FF0000,w:5px)
> 
> However, it did not make any difference. Perhaps OFS is not
> supported yet, or? 


Oh, I didn't even know that those .ofs file existed, but indeed I see them 
mentionned in http://www.gdal.org/ogr/ogr_feature_style.html . However, from a 
quick look, although this seems to be implemented in ogr/ogrfeaturestyle.cpp, 
this feature isn't used by any driver.

> I did notice that I can change the colour
> of the features through Acrobat reader's UI, but I cannot set
> the line width. As a first aid I would suggest to use wider
> lines and bigger points as defaults.
	
Yes, as far as I remember the current state of the code, the pen width is 
scaled with the coordinates of the geometries, so the appropriate value of the 
width depends on whether you work with projected or geographic SRS, and the 
layer spatial extent.

> Areas, which are drawn
> as semi-transparent with a light grey fill are OK.

Even if table level styling isn't supported, the PDF writer can fetch the 
style at the feature level (not at the table level like you tried). You can 
for example try the following to attach the style to the features :

ogr2ogr -f PDF poly.pdf poly.shp -sql "select *, 'PEN(c:#FF0000,w:5px)' as 
OGR_STYLE from poly"

Best regards,

Even


More information about the gdal-dev mailing list