[mapserver-dev] Re: Serving attributes from postgres hstore collumn as wfs.

reholl reh2 at prodigy.net
Mon Jan 30 13:46:35 EST 2012

Morten Olsen Lysgaard wrote
> The hstore question can be summarized as follows:
> Has anyone used a hstore column in postgres for attributes on WFS
> features?
> It's much more flexible than using one column for each attribute and 
> faster too. The problem is that mapserver doesn't seem to natively 
> support them. Anyone have experience with this?

Please forgive the half-baked reply here, but here's how I would experiment
with this problem, if I had more time at the moment to do so...

Assumption 1: ordinarily, Mapserver-as-WFS-Server converts LAYER
TYPE=POSTGIS from mapfile to WFS feature by preserving all the pgsql column
names across the feature, and on each instance, the row values from pgsql
query become the WFS feature values, including the_geom

Assumption 2: Mapserver-as-WFS-Server will honor any custom DATA column
names and values along the lines of "the_geom FROM (SELECT /something /AS
id, /geometry_expression/ as the_geom,... /expression1/ as column1, ...
/expression_n/ as column_n FROM old_table WHERE...) AS foo USING UNIQUE id
...SRID=...." such that my invented column1...column_n will become column
names in WFS

QUESTION: when using hstore type in pgsql, can I query the individual sub
elements of the hstore value along the lines of "
hstore_column_1.sub_element_a AS pretend_top_level_column_1a, ... ,
hstore_column_1.sub_element_z AS pretend_top_level_column_1z,...,
hstore_column_n.sub_element_g AS pretend_top_level_column_nz, ....? (brief
look at pgsql docs on the subject suggest YES)

If so, then as long as you map the subelement AS as top-level-looking column
in the mapserver DATA sub query, then the normal mechanism will handle the

Hope this is a helpful start,

View this message in context: http://osgeo-org.1560.n6.nabble.com/Serving-attributes-from-postgres-hstore-collumn-as-wfs-tp4346333p4351560.html
Sent from the Mapserver - Dev mailing list archive at Nabble.com.

More information about the mapserver-dev mailing list