On Sat, 2009-11-14 at 21:58 +0200, Ciprian Talaba wrote: > I am trying to do some work with the public transport network, and for > that I need to get the roles (forward/backward mainly) of the route > members as attributes of ways(lines) in PostGIS. I am using osm2pgsql > and I hoped to get this done by modifying the default style. I have > added a new line in the style file "way role text linear" but > this is not working (maybe it's obvious why not for some of you). > > Also I was looking at the osm2pgsql source code and I saw that getting > information about the cycling network is treated separated in the code > (in output-pgsql.c), and I was thinking of doing the same for public > transport. > > Do you know if there is a way for doing this with the style, or I have > to dig more in the code? Any pointers will be appreciated.
I'm afraid the relation roles are not accessible in the style file. Pretty much all the relation processing is handled in the C code and each type of relation needs special handling. When a route relation is converted into a postgis geometry all of the constituent ways are joined into a single linestring. There is no obvious place where the role of each individual way could be recorded on this linestring. One possibility might be to keep the members as separate linestrings for and then add an artificial tag, say route_role=... in the output. Another approach might be for you to query the planet_osm_rels table (provided you imported the data in --slim mode). This contains the raw data listing all the relations and their members. Armed with this information you could then query the planet_osm_line table to obtain the geometry for each of these ways (all the members will probably appear as distinct roads in this table). Jon _______________________________________________ talk mailing list talk@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk