OGR Autostyling and other providers, styling RFC?

Steve Lime Steve.Lime at DNR.STATE.MN.US
Tue Nov 20 00:29:30 EST 2007


You can do some per feature styling using separate items using the attribute binding
approach introduced in 5.0. It requires multiple items but also allows for some things
to be constant and others to vary by feature. Is that a possible work around?

Steve

>>> Frank Warmerdam <warmerdam at POBOX.COM> 11/19/07 12:04 PM >>>
Folks,

I'm helping someone who wants to load mapinfo data into PostGIS and then
render it with MapServer.  They would like the same sort of autostyling
that is available through the OGR provider when operating directly from
mapinfo format.

We have loaded the OGR style string as a regular field in Postgres (named
ogr_style) but the postgis driver does not support autostyling.

I have prepared a patch that implements automatic use of a field named
ogr_style using normal OGR->mapserver style conversion rules in my local
tree.  But it has a number of "issues".

1) I have to trick the Postgres provider into including the ogr_style
field in the request.  Currently I do this by having a bogus expression
using the [ogr_style] field on the class.

2) Things are hardcoded to a particular field name.  I'm guessing from the
way that STYLEITEM "AUTO" is setup, that the original intent was that a
field name could be the argument to STYLEITEM, instead of "AUTO", but that
this was just never done.  Likewise the styleitemindex field does not appear
to ever be actually used currently.

3) The msPOSTGISLayerGetAutoStyle() is currently implemented to assume that
the style comes from the last record read with msPOSTGISLayertNextShape().
Does autostyling really need to work with "randomly read" features?  Is
it used ever to style query results?

4) I can't help but wonder if the GetAutoStyle() function shouldn't pass in
the shape being operated on instead of passing in the tile/record values. In
some/many cases the style will be right in the shape.

5) Do we want to support non-OGR styling mechanisms in data providers?  Should
there be styling "dialects"?

I'm considering writing an RFC to broaden the "STYLEITEM" mechanism to more
providers and to pulling the style string from an arbitrary field.  Can anyone
think of stuff I ought to take into consideration in writing up such a thing?

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-dev mailing list