<!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> </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> </DIV>
<DIV><FONT face=Arial size=2>I imported <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>.
They got all dumped into </SPAN> </FONT></DIV>
<DIV><FONT face=Arial size=2>one singe column <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 <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 <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> </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 <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.
</SPAN>I will try to keep <SPAN
class=511350309-10092010>my </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> </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&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,POI_free_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&tag=shop&value=supermarket">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,POI_free_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&tag=shop&value=supermarket</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,POI_free_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&tag=amenity&value=fuel">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,POI_free_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&tag=amenity&value=fuel</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2>Hstore query works also with lines and
polygons:<BR>A 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&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,maxspeed_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&maxspeed=100">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=1059&HEIGHT=687&LAYERS=sea,borders,maxspeed_query&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=-574187,6558020,1615375,7978444&SRS=EPSG:3067&STYLES=&maxspeed=<SPAN
class=511350309-10092010>100</A></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Then <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&service=wfs&version=1.1.0&request=getfeature&typename=POI_free_query&maxfeatures=10&tag=amenity&value=toilets"><FONT
face=Arial
size=2>http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&service=wfs&version=1.1.0&request=getfeature&typename=POI_free_query&maxfeatures=10&tag=amenity&value=toilets</FONT></A></DIV>
<DIV><FONT face=Arial size=2></FONT> </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&service=wfs&version=1.1.0&request=getfeature&typename=POI_free_query&maxfeatures=100&tag=amenity&value=restaurant">http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&service=wfs&version=1.1.0&request=getfeature&typename=POI_free_query&maxfeatures=100&tag=amenity&value=restaurant</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If the service is up you will see that WFS is
sending all the tags as a one string, like
this:<BR><ms:tags><BR>"name"=>"Fantasia", "amenity"=>"restaurant",
"cuisine"=>"pizza", "wheelchair"=>"yes", "opening_hours"=>"Mo-Fr
10:30-19:30; Sa 12:00-19:30; Su 13:00-19:30"<BR></ms:tags></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2>So both the WMS<SPAN
class=511350309-10092010> (including getFeatureInfo)</SPAN> and WFS are
working <SPAN class=511350309-10092010>very nice </SPAN>if <SPAN
class=511350309-10092010>the query is done by sending </SPAN><SPAN
class=511350309-10092010> </SPAN><BR><SPAN class=511350309-10092010>extra
parameters w</SPAN>ith the getMap or getFeature requests.<SPAN
class=511350309-10092010> </SPAN> However, that is not especially standard
way </FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>to do queries<SPAN
class=511350309-10092010>. 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 do selections from the hstore <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> </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&service=wfs&version=1.1.0&request=getfeature&typename=tagsoup&maxfeatures=10"><FONT
face=Arial
size=2>http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&service=wfs&version=1.1.0&request=getfeature&typename=tagsoup&maxfeatures=10</FONT></A></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> TYPE
POINT<BR> STATUS ON<BR>
PROJECTION<BR>
"init=epsg:3067"<BR> #UTM
because Web Mercator makes Finland ugly<BR>
END<BR> NAME "POI_free_query"<BR> INCLUDE
"/usr/map/connection.map"<BR> DATA "way from (select
(way),osm_id,tags from osm_point where (tags @>'%tag%=>%value%')) as foo
using unique osm_id using srid=3067"<BR> #<SPAN
class=511350309-10092010> </SPAN>I feel that more recent MapServer versions
demands validation<BR> METADATA<BR>
"wfs_title" "free_tag_query"<BR> "gml_featureid"
"osm_id"<BR> "gml_include_items"
"osm_id,tags"<BR> END<BR> DUMP
TRUE<BR> #DEBUG 5<BR> TEMPLATE
"/usr/templates/mstemplate.html"<BR>
CLASS<BR> STYLE<BR> SIZE
10<BR> SYMBOL "citycircle"<BR>
COLOR "#FF6767"<BR> OUTLINECOLOR 0 0 0<BR>
END<BR>
STYLE<BR> SIZE
2<BR> SYMBOL
"citycircle"<BR> COLOR
"#000000"<BR> END<BR>
END<BR>END</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>-Jukka Rahkonen-</FONT></DIV></BODY></HTML>