STYLEITEM with postgis datasource (via OGR)
Frank Warmerdam
fwarmerdam at GMAIL.COM
Wed Feb 9 10:20:50 PST 2005
On Wed, 9 Feb 2005 17:56:49 +0100, Lionel Bargeot <l.bargeot at educagri.fr> wrote:
> I would like to use a field in my database to define object's style on
> the map, or to build this field on the fly.
>
> My map file looks like something like this :
>
> LAYER
> CONNECTIONTYPE OGR
> NAME "villes"
> CONNECTION "PG:dbname=form user=... password=... host=127.0.0.1
> port=5432"
> DATA "select oid,
> lower(nom_comm) as nom,
> 'BRUSH(fc:\#ff0000,id:mapinfo-sym-35)' as Style,
> buffer(the_geom,2500) as the_geom from ville
> where population > 5"
> STYLEITEM "style" # AUTO looks for Style
> .....
> END
>
> I inspire myself with an ogrinfo output on a TAB file to produce the
> line with the BRUSH definition. The query works well with the usual psql
> interpreter. I added symbolset definition to my own symbol file to be
> sure to have those symbol definitions in my symbolset.
>
> But all the results I obtain are blank maps with labels :-(
>
> Do you know if there is a possibility (or not) about this idea to work a
> day ?
Lionel,
Are you hoping to have "OGR Auto-styling" kick in based on reading
an attribute with style strings? I don't think this works. I believe that
autostyling is only applied if you use specifically 'STYLEITEM "AUTO"' and
then it fetches the style item from the "special" style attribute of
the feature.
This isn't a real attribute though, and even naming an attribute style isn't
the same as the "official" style string.
What you need is a way of telling mapserver to use autostyling, but
to read the style from a named attribute. I don't think that exists, but
it could be added reasonably easily.
I would add that Daniel Morissette is the authority on OGR autostyling
in mapserver, and might have more to add. However, he is sometimes
to busy to stay on top of mapserver-users questions.
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 | Geospatial Programmer for Rent
More information about the MapServer-users
mailing list