[gdal-dev] Geospatial PDF with OGR_DATASOURCE

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Tue Jun 5 00:12:19 PDT 2012


Even Rouault wrote:

 
> > 
> > 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"

I want to combine raster and vector sources but I found
it impossible to discover how to use the -sql parameter
together with the PDF creation option -co OGR_DATASOURCE=
Fortunately it was enough to add an attribute named OGR_STYLE
into the shapefile and fill in styles as strings. Styles are 
really applied feature by feature so it is possible to set
colours and line widths individually for each feature in the
shapefile, which is pretty amusing.

I could symbolize lines and polygons with PEN and BRUSH by
using the examples from http://www.gdal.org/ogr/ogr_feature_style.html
However, I could not make SYMBOL settings to work with my
points. They appear as grey circles even if I attached some
OGR_STYLE strings to them, like
 SYMBOL(c:#00FF00,id:"ogr-sym-7")

I was able to set the colours of the points by using PEN but 
altering the w: parameter did not change the size of the 
points.

-Jukka Rahkonen-

> Best regards,
> 
> Even
> 


More information about the gdal-dev mailing list