[gdal-dev] styles .ofs and OGR_STBL_GetNextStyle()

Nik Sands nixanz at nixanz.com
Tue Jul 29 21:47:23 PDT 2014


Hi Devs,

I'm just planning to convert my own 'in-house' drawing styles management to using the styles management built into OGR.  The documentation at http://www.gdal.org/ogr_feature_style.html suggests that styles can be in a '.ofs' file to be automatically associated with a data source of the same name as the .ofs file.

But how about if the .ofs file is a stand-alone file passed directly to OGR_STBL_LoadStyleTable()?  Eg, OGR_STBL_LoadStyleTable(table, "/path/to/styles.ofs")

In this case the first two calls to 'OGR_STBL_GetNextStyle(table)' will return the 'styles':

OFS-Version :  1.0
2014-07-30 14:38:36.392 Maps n Trax[47458:60b] StyleField :  "style"

Which are of course not styles at all, but part of the .ofs specification.

From this, I assume that files passed into OGR_STBL_LoadStyleTable() should in fact NOT be .ofs files, but merely plain text files with raw style strings only (and no .ofs specifications).

Is this correct?

Would there be any advantage on getting OGR_STBL_LoadStyleTable() to ignore the first line or two if it is an .ofs file and those two lines match the spec?

Cheers,
Nik.


OFS-Version: 1.0
StyleField: "style"

DefaultStyle: SYMBOL(c:#000000,id:"ogr-sym-3",s:5pt); PEN(c:#000000,w:2pt); BRUSH(fc:#80808080); LABEL(c:#000000,s:14pt,t:{title})

locality: LABEL(c:#000000,s:24pt,t:{title})
town: SYMBOL(c:#800000,id:"ogr-sym-3",s:10pt); LABEL(c:#800000,s:24pt,t:{title})
city: SYMBOL(c:#800000,id:"ogr-sym-3",s:15pt); LABEL(c:#800000,s:24pt,t:{title})
region: PEN(c:#000000,w:2pt); BRUSH(fc:#80808080); LABEL(c:#000000,s:28pt,t:{title})
country: PEN(c:#000000,w:2pt); BRUSH(fc:#80808080); LABEL(c:#000000,s:32pt,t:{title})

vegetation_low: BRUSH(fc:#A0F0A0); LABEL(c:#004000,s:18pt,t:{title})
vegetation_medium: BRUSH(fc:#80C080); LABEL(c:#004000,s:18pt,t:{title})
vegetation_high: BRUSH(fc:#008000); LABEL(c:#004000,s:18pt,t:{title})
water: SYMBOL(c:#000080,id:"ogr-sym-3",s:2pt); PEN(c:#000080,w:2pt,p:"18pt 8pt"); BRUSH(fc:#8080C0); LABEL(c:#000080,s:18pt,t:{title})
contour: PEN(c:#808080,w:1pt); LABEL(c:#808080,s:12pt,t:{elevation})

road_unsealed: PEN(c:#A08080,w:2pt,p:"10pt 6pt"); LABEL(c:#000000,s:18pt,t:{title})
road_minor: PEN(c:#A08080,w:2pt); LABEL(c:#000000,s:18pt,t:{title})
road_medium: PEN(c:#A00000,w:4pt); LABEL(c:#000000,s:18pt,t:{title})
road_major: PEN(c:#A00000,w:6pt); LABEL(c:#000000,s:18pt,t:{title})

route: PEN(c:#000000,w:2pt,p:"2pt 4pt"); LABEL(c:#000000,s:18pt,t:{title})
track: PEN(c:#000000,w:2pt,p:"10pt 6pt"); LABEL(c:#000000,s:18pt,t:{title})
rail: PEN(c:#000000,w:4pt,p:"2pt 5pt"); LABEL(c:#000000,s:18pt,t:{title})
cable: PEN(c:#000000,w:2pt,p:"1pt 6pt"); LABEL(c:#000000,s:18pt,t:{title})
ferry: PEN(c:#000080,w:2pt,p:"18pt 8pt"); LABEL(c:#000080,s:18pt,t:{title})



More information about the gdal-dev mailing list