[TinyOWS-users] Making WFS queries against hstore attribute

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Fri May 6 07:13:48 EST 2011


Hi,
 
TinyOWS can read attributes of datatype "hstore" from PostGIS and
publish them through WFS fine.
Here is an example DescribeFeatureType request
http://188.64.1.61/cgi-bin/tinyows?service=wfs&version=1.1.0&request=des
cribeFeatureType&typename=osm_polygon
 
The second last attribute "tags" is a hstore columg in the database. In
the TinyOWS schema it is translated into string
<xs:element name="tags" type="string" nillable="true" minOccurs="0"
maxOccurs="1"/>
 
This is an example of GetFeature
http://188.64.1.61/cgi-bin/tinyows?service=wfs&version=1.1.0&request=get
feature&typename=osm_polygon&maxfeatures=1
 
It returns all the tags in one string like
<tows:tags>"z_order"=>"0", "building"=>"yes",
"way_area"=>"4541.749900"</tows:tags>
 
This is nice.  It would be even more cool to be able to do also queries
by hstore attributes but I guess it is not possible at the moment.  What
do you think, could it be possible to convert for example WFS
PropertyIsEqualTo filters by TinyOWS server so that they would work
against PostgreSQL hstore column?
 
The SQL syntax with hstore looks odd and I do not really understand it
yet, but queries like these are working
select * FROM osm_polygon where ((tags->'building') = 'yes');
select * from osm_polygon where (tags @>'building=>yes')
 
What I am thinking that perhaps, if WFS GetFeature would contain this
kind of filter
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>tags</ogc:PropertyName>
<ogc:Literal>(tags @>'building=>yes')</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
 
then if TinyOWS recognises that tags column in the database is of
datatype "hstore", it would convert the filter into 
where ((tags->'building') = 'yes')
 
Does this sound like a useful feature and possible to implement?
 
-Jukka Rahkonen-
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/tinyows-users/attachments/20110506/695e4a39/attachment.htm 


More information about the TinyOWS-users mailing list