<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.6003" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Got INSPIREd at FOSS4G and desided to have a try 
with paleogissic MapServer<BR>WMS and WFS services with OpenStreetMess (OSM) 
data.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I imported&nbsp;<SPAN 
class=511350309-10092010>an</SPAN> OSM excerpt of Finland with osm2pgsql utility 
by using the -k switch<BR>for storing all the OSM tags and values in<SPAN 
class=511350309-10092010>to</SPAN> PostGIS<SPAN class=511350309-10092010>.&nbsp; 
They&nbsp;got all dumped into&nbsp;</SPAN>&nbsp;</FONT></DIV>
<DIV><FONT face=Arial size=2>one singe column&nbsp;<SPAN 
class=511350309-10092010>"tags" which is </SPAN>of datatype 
"hstore"</FONT></DIV>
<DIV><A href="http://www.postgresql.org/docs/8.4/static/hstore.html"><FONT 
face=Arial 
size=2>http://www.postgresql.org/docs/8.4/static/hstore.html</FONT></A><BR><FONT 
face=Arial><FONT size=2>Then I created a&nbsp;<SPAN class=511350309-10092010>few 
</SPAN>simple layer<SPAN class=511350309-10092010>s</SPAN> by querying tags and 
values from the hstore<SPAN 
class=511350309-10092010>.</SPAN></FONT></FONT></DIV>
<DIV><SPAN class=511350309-10092010></SPAN><FONT face=Arial 
size=2>See&nbsp;<SPAN class=511350309-10092010>an example of </SPAN>layer 
definitions from the bottom of this message</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2>Now it is possib<SPAN 
class=511350309-10092010>l</SPAN>e to try how WMS behaves with&nbsp;<SPAN 
class=511350309-10092010>hstore. By editing the "tag" and "value" 
keys</SPAN></FONT></FONT></DIV>
<DIV><SPAN class=511350309-10092010></SPAN><FONT face=Arial><FONT size=2><SPAN 
class=511350309-10092010>it is possible to get what ever map you like. 
&nbsp;</SPAN>I will try to keep&nbsp;<SPAN 
class=511350309-10092010>my&nbsp;</SPAN>demo service online </FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>at least for a wee<SPAN 
class=511350309-10092010>k for testing.</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>A supermarketmap<BR><A 
href="http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;WIDTH=1059&amp;HEIGHT=687&amp;LAYERS=sea,borders,POI_free_query&amp;TRANSPARENT=TRUE&amp;FORMAT=image%2Fpng&amp;BBOX=-574187,6558020,1615375,7978444&amp;SRS=EPSG:3067&amp;STYLES=&amp;tag=shop&amp;value=supermarket">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;WIDTH=1059&amp;HEIGHT=687&amp;LAYERS=sea,borders,POI_free_query&amp;TRANSPARENT=TRUE&amp;FORMAT=image%2Fpng&amp;BBOX=-574187,6558020,1615375,7978444&amp;SRS=EPSG:3067&amp;STYLES=&amp;tag=shop&amp;value=supermarket</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>A fuelstationmap<BR><A 
href="http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;WIDTH=1059&amp;HEIGHT=687&amp;LAYERS=sea,borders,POI_free_query&amp;TRANSPARENT=TRUE&amp;FORMAT=image%2Fpng&amp;BBOX=-574187,6558020,1615375,7978444&amp;SRS=EPSG:3067&amp;STYLES=&amp;tag=amenity&amp;value=fuel">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;WIDTH=1059&amp;HEIGHT=687&amp;LAYERS=sea,borders,POI_free_query&amp;TRANSPARENT=TRUE&amp;FORMAT=image%2Fpng&amp;BBOX=-574187,6558020,1615375,7978444&amp;SRS=EPSG:3067&amp;STYLES=&amp;tag=amenity&amp;value=fuel</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2>Hstore query works also with lines and 
polygons:<BR>A&nbsp;maxspeedmap<SPAN class=511350309-10092010> (fixed, only 
maxspeed value is selectable)</SPAN><BR><A 
href="http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;WIDTH=1059&amp;HEIGHT=687&amp;LAYERS=sea,borders,maxspeed_query&amp;TRANSPARENT=TRUE&amp;FORMAT=image%2Fpng&amp;BBOX=-574187,6558020,1615375,7978444&amp;SRS=EPSG:3067&amp;STYLES=&amp;maxspeed=100">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;WIDTH=1059&amp;HEIGHT=687&amp;LAYERS=sea,borders,maxspeed_query&amp;TRANSPARENT=TRUE&amp;FORMAT=image%2Fpng&amp;BBOX=-574187,6558020,1615375,7978444&amp;SRS=EPSG:3067&amp;STYLES=&amp;maxspeed=<SPAN 
class=511350309-10092010>100</A></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Then&nbsp;<SPAN class=511350309-10092010>gml output 
from </SPAN>WFS, "Get 10 toilets"<BR></FONT><A 
href="http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;service=wfs&amp;version=1.1.0&amp;request=getfeature&amp;typename=POI_free_query&amp;maxfeatures=10&amp;tag=amenity&amp;value=toilets"><FONT 
face=Arial 
size=2>http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;service=wfs&amp;version=1.1.0&amp;request=getfeature&amp;typename=POI_free_query&amp;maxfeatures=10&amp;tag=amenity&amp;value=toilets</FONT></A></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>or "Get 100 restaurants"<BR><A 
href="http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;service=wfs&amp;version=1.1.0&amp;request=getfeature&amp;typename=POI_free_query&amp;maxfeatures=100&amp;tag=amenity&amp;value=restaurant">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;service=wfs&amp;version=1.1.0&amp;request=getfeature&amp;typename=POI_free_query&amp;maxfeatures=100&amp;tag=amenity&amp;value=restaurant</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>If the service is up you will see that WFS is 
sending&nbsp;all the&nbsp;tags as a one string, like 
this:<BR>&lt;ms:tags&gt;<BR>"name"=&gt;"Fantasia", "amenity"=&gt;"restaurant", 
"cuisine"=&gt;"pizza", "wheelchair"=&gt;"yes", "opening_hours"=&gt;"Mo-Fr 
10:30-19:30; Sa 12:00-19:30; Su 13:00-19:30"<BR>&lt;/ms:tags&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2>So both the WMS<SPAN 
class=511350309-10092010> (including getFeatureInfo)</SPAN>&nbsp;and WFS are 
working&nbsp;<SPAN class=511350309-10092010>very nice&nbsp;</SPAN>if&nbsp;<SPAN 
class=511350309-10092010>the query&nbsp;is done by sending&nbsp;</SPAN><SPAN 
class=511350309-10092010>&nbsp;</SPAN><BR><SPAN class=511350309-10092010>extra 
parameters&nbsp;w</SPAN>ith the getMap or getFeature requests.<SPAN 
class=511350309-10092010> </SPAN>&nbsp;However, that is not especially standard 
way </FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>to do queries<SPAN 
class=511350309-10092010>.&nbsp;Thus this is my </SPAN></FONT></FONT><FONT 
face=Arial size=2>question:</FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>Is is somehow possible 
to&nbsp;do&nbsp;selections from the hstore&nbsp;<SPAN 
class=511350309-10092010>backend </SPAN>by using WFS <SPAN 
class=511350309-10092010>attribute </SPAN>filter<SPAN 
class=511350309-10092010>s?</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=511350309-10092010></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=511350309-10092010>There is 
</SPAN><SPAN class=511350309-10092010>a</SPAN>n unfiltered feature type 
"tagsoup"<SPAN class=511350309-10092010> available in my WFS 
service</SPAN></FONT></FONT></DIV>
<DIV><A 
href="http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;service=wfs&amp;version=1.1.0&amp;request=getfeature&amp;typename=tagsoup&amp;maxfeatures=10"><FONT 
face=Arial 
size=2>http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&amp;service=wfs&amp;version=1.1.0&amp;request=getfeature&amp;typename=tagsoup&amp;maxfeatures=10</FONT></A></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>If someone gets interested in trying to apply WFS 
filters for this feature type, just go ahead and tell if they work.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><BR><FONT face=Arial size=2>LAYER<BR>&nbsp;&nbsp;&nbsp; TYPE 
POINT<BR>&nbsp;&nbsp;&nbsp; STATUS ON<BR>&nbsp;&nbsp;&nbsp; 
PROJECTION<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"init=epsg:3067"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #UTM 
because Web Mercator makes Finland ugly<BR>&nbsp;&nbsp;&nbsp; 
END<BR>&nbsp;&nbsp;&nbsp; NAME "POI_free_query"<BR>&nbsp;&nbsp;&nbsp; INCLUDE 
"/usr/map/connection.map"<BR>&nbsp;&nbsp;&nbsp; DATA "way from (select 
(way),osm_id,tags from osm_point where (tags @&gt;'%tag%=&gt;%value%')) as foo 
using unique osm_id using srid=3067"<BR>&nbsp;&nbsp;&nbsp; #<SPAN 
class=511350309-10092010> </SPAN>I feel that more recent MapServer versions 
demands validation<BR>&nbsp;&nbsp;&nbsp;&nbsp; METADATA<BR>&nbsp;&nbsp;&nbsp; 
"wfs_title" "free_tag_query"<BR>&nbsp;&nbsp;&nbsp; "gml_featureid" 
"osm_id"<BR>&nbsp;&nbsp;&nbsp; "gml_include_items" 
"osm_id,tags"<BR>&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp;&nbsp; DUMP 
TRUE<BR>&nbsp;&nbsp;&nbsp; #DEBUG 5<BR>&nbsp;&nbsp;&nbsp; TEMPLATE 
"/usr/templates/mstemplate.html"<BR>&nbsp;&nbsp;&nbsp; 
CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STYLE<BR>&nbsp;&nbsp; SIZE 
10<BR>&nbsp;&nbsp;&nbsp;&nbsp; SYMBOL "citycircle"<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
COLOR "#FF6767"<BR>&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 0 0 0<BR>&nbsp;&nbsp; 
END<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE 
2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SYMBOL 
"citycircle"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 
"#000000"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp;&nbsp; 
END<BR>END</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-Jukka Rahkonen-</FONT></DIV></BODY></HTML>