Hello Jon,<br><br><div class="gmail_quote">On Sat, Nov 14, 2009 at 10:49 PM, Jon Burgess <span dir="ltr"><<a href="mailto:jburgess777@googlemail.com">jburgess777@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Sat, 2009-11-14 at 21:58 +0200, Ciprian Talaba wrote:<br>
> I am trying to do some work with the public transport network, and for<br>
> that I need to get the roles (forward/backward mainly) of the route<br>
> members as attributes of ways(lines) in PostGIS. I am using osm2pgsql<br>
> and I hoped to get this done by modifying the default style. I have<br>
> added a new line in the style file "way role text linear" but<br>
> this is not working (maybe it's obvious why not for some of you).<br>
><br>
> Also I was looking at the osm2pgsql source code and I saw that getting<br>
> information about the cycling network is treated separated in the code<br>
> (in output-pgsql.c), and I was thinking of doing the same for public<br>
> transport.<br>
><br>
> Do you know if there is a way for doing this with the style, or I have<br>
> to dig more in the code? Any pointers will be appreciated.<br>
<br>
</div></div>I'm afraid the relation roles are not accessible in the style file.<br>
Pretty much all the relation processing is handled in the C code and<br>
each type of relation needs special handling.<br>
<br>
When a route relation is converted into a postgis geometry all of the<br>
constituent ways are joined into a single linestring. There is no<br>
obvious place where the role of each individual way could be recorded on<br>
this linestring.<br>
<br>
One possibility might be to keep the members as separate linestrings for<br>
and then add an artificial tag, say route_role=... in the output.<br>
<br>
Another approach might be for you to query the planet_osm_rels table<br>
(provided you imported the data in --slim mode). This contains the raw<br>
data listing all the relations and their members. Armed with this<br>
information you could then query the planet_osm_line table to obtain the<br>
geometry for each of these ways (all the members will probably appear as<br>
distinct roads in this table).<br>
<font color="#888888"><br>
Jon<br>
<br>
<br>
</font></blockquote></div><br>Thank you about this info. I will probably start with the last approach (using planet_osm_rels and planet_osm_line tables) because this will keep my code separate from osm2pgsql. I will try to publish my tries because I believe others will be interested in something like this.<br>
<br>Regards,<br>Ciprian<br>