Frederik Ramm wrote:
>> * Some sort of application that answers to wfsGetFeatureInfo requests and returns all the tags and relations tags about objects. >> This last point is the missing bit, how can I achieve this? Do I have to >> code something from scratch or has anything like this been done before. > > The simplest way would probably be tweaking osm2pgsql/imposm so that the >information that you care about is copied into the geometry tables, most >likely making a separate geometry for each relation (e.g. this is how >route relations are turned into geometries for things like OpenCycleMap) >but possibly also merging the information from several relations into one >resulting geometry object. That way, you can then run a simple Mapserver >or Geoserver installation and GetFeatureInfo will magically work. You would probably want to use WFS GetFeature. GetFeatureInfo belongs to Web Map Service (WMS) and it can be tweaked to return data as GML/XML, KML, html or what ever but the main use is to let users click on a map and ask server to send information about the feature that is closest to the clicked point. Standard though optional feature of WMS and mostly missing in OSM web maps. Setting up WFS on top of tables imported with osm2pgsql is pretty easy with Mapserver and Geoserver. However, Geoserver does not support PostgreSQL hstore column at all so you'd be able to send just a fixed set of tags. Mapserver can send also all the tags, even they are not queryable with standard WFS calls. With vendor specific parameters and runtime substitution you can query whatever you want with Mapserver. I will show an example a bit later. Third alternative is TinyOWS WFS. Configuring it to deliver osm_point, osm_line and osm_polygon tables through WFS is extremely easy. TinyOWS can also send all the tags from hstore column. It looks like osm2pgsql does not merge route members into selfstanding geometry objects. Therefore the following sample queries will send routes as a short segments. I pologise that the URLs are so ugly but it is how OGC has defined them. It will be easier to read the filters by url-decoding them. Filters are just XML and therefore computer friendly. This request will send one hunder route features (route is not null in osm_line) with geometry and ref and route attributes and also all the tags. Geometry is not compulsory, just take is out from propertyname list and you'll get just attributes. Plain attribute query may make sense sometimes especially with spatial filters. http://188.64.1.61/cgi-bin/tinyows?service=wfs&version=1.0.0&request=getfeature&typename=tows:osm_line&maxfeatures=100&filter=%3CFilter++xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22%3E%3Cogc%3ANot%3E%3Cogc%3APropertyIsNull%3E%3Cogc%3APropertyName%3Etows%3Aroute%3C%2Fogc%3APropertyName%3E%3C%2Fogc%3APropertyIsNull%3E%3C%2Fogc%3ANot%3E%3C%2FFilter%3E&propertyname=route,ref,tags,way My server is using EPSG:3067 by default, if EPSG:4326 feels better then ask for it http://188.64.1.61/cgi-bin/tinyows?service=wfs&version=1.0.0&request=getfeature&typename=tows:osm_line&maxfeatures=100&filter=%3CFilter++xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22%3E%3Cogc%3ANot%3E%3Cogc%3APropertyIsNull%3E%3Cogc%3APropertyName%3Etows%3Aroute%3C%2Fogc%3APropertyName%3E%3C%2Fogc%3APropertyIsNull%3E%3C%2Fogc%3ANot%3E%3C%2FFilter%3E&propertyname=route,ref,tags,way&srsname=EPSG:4326 And if the Google projection and geojson feels even more good then do as follows. You will see that TinyOWS does not respect selecting a list of attributes with geojson output but it is just a bug. http://188.64.1.61/cgi-bin/tinyows?service=wfs&version=1.0.0&request=getfeature&typename=tows:osm_line&maxfeatures=100&filter=%3CFilter++xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22%3E%3Cogc%3ANot%3E%3Cogc%3APropertyIsNull%3E%3Cogc%3APropertyName%3Etows%3Aroute%3C%2Fogc%3APropertyName%3E%3C%2Fogc%3APropertyIsNull%3E%3C%2Fogc%3ANot%3E%3C%2FFilter%3E&propertyname=route,ref,tags,way&srsname=EPSG:900913&outputformat=application/json Increase the maxFeatures parameter and you will get more data. I do not have any limit on server side. Filters in WFS suit better for sending through http POST and the following posted to http://188.64.1.61/cgi-bin/tinyows? will send data about route number 503. <wfs:GetFeature xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" maxFeatures="1000" outputFormat="GML2"><wfs:Query xmlns:tows="http://www.tinyows.org/" typeName="tows:osm_line"><ogc:PropertyName>tows:operator</ogc:PropertyName><ogc:PropertyName>tows:osm_id</ogc:PropertyName><ogc:PropertyName>tows:ref</ogc:PropertyName><ogc:PropertyName>tows:route</ogc:PropertyName><ogc:PropertyName>tows:tags</ogc:PropertyName><ogc:PropertyName>tows:way</ogc:PropertyName><ogc:Filter><ogc:And><ogc:Not><ogc:PropertyIsNull><ogc:PropertyName>tows:route</ogc:PropertyName></ogc:PropertyIsNull></ogc:Not><ogc:PropertyIsLike wildCard="*" singleChar="?" escape="\"><ogc:PropertyName>tows:ref</ogc:PropertyName><ogc:Literal>503</ogc:Literal></ogc:PropertyIsLike></ogc:And></ogc:Filter></wfs:Query></wfs:GetFeature> Mapserver allows to use variables with runtime substitution which can make http queries more understandable. The following is doing selection directly from the osm_line hstore columns and every tag that exists can be used for queries. Actuallu, even tags which do not exist. (tags @> 'highway=>primary') AND not (tags ? 'maxspeed') is selectign primary highways which do not have maxspeed tag. Very flexible. http://188.64.1.61/cgi-bin/ms_ows?service=wfs&version=1.0.0&request=getfeature&typename=osm_viivat&sql=(tags ? 'route') AND (tags @> 'ref=>503') -Jukka Rahkonen- > > Bye > Frederik > > _______________________________________________ > dev mailing list > [email protected] > http://lists.openstreetmap.org/listinfo/dev > _______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

