[OSM-dev] osm2pgsql: support for local route names

Kai Krueger kakrueger at gmail.com
Mon Apr 15 07:04:31 UTC 2013


RainerU-2 wrote
> Hello Kai,
> 
> Am 14.04.2013 21:47, schrieb Kai Krueger:
>> 
>> Perhaps I don't quite understand what you need, but does osm2pgsql not
>> already do this?
>> 
> 
> osm2psql creates a way entry in the planet_osm_line table for each member
> of a
> route relation. The name tag of the relation is copied as route_name from
> planet_osm_rels to each of these ways, along with some other tags specific
> for
> hiking and cycling routes. This allows to render routes with simple query
> statements.

If I am not mistaken, it tries to create one entry per relation. However, as
in its default mode, osm2pgsql does not create multi-geometries, there will
be one entry per contiguous geometry in the planet_osm_lines table. It is
not per member way. If you have hstore enabled, these entries obtain all of
the tags, including e.g. name:fr from the relation they represent. For route
relations, they do not contain any information other than the geometry from
the member ways.

In addition the individual member ways are also in the planet_osm_line
table, but those do not contain any tags from the relation.


One problem you might be facing is that osm2pgsql does not handle relations
of relations, or relations of relations of relations... It seem many of e.g.
the Swiss cycle network is constructed of relations of relations and the
international names seem to be on the outer most relations.  Therefore the
correct taging is only applied to the geometry sections of ways that are
directly a member of the parent relation.

 

RainerU-2 wrote
> With the hstore option (which I was not aware of before Shaun mentioned
> it) all
> the tags of the relation are stored in planet_osm_rels but not in the
> derived
> ways in planet_osm_line.

No, the hstore option does not have an effect on the planet_osm_rels table.
The planet_osm_rels tables has all of the tags of the relations, wether you
select hstore or not. However, those do not contain any postgis geometries
and are therefore not easily used directly in rendering. The hstore option
influences the rendering tables, i.e. planet_osm_{point|line|roads|polygons}
and can be used directly in rendering with the apropriate options in mapnik.


RainerU-2 wrote
>  To access these tags one had to build a query that goes
> through the member column values of the relations and gets the associated
> ways.
> This is a bit too complex for non-database geeks like me.
> 
> One solution would be to add the osm_id of the relation to the derived
> ways.
> This would provide a not too complex way to query these ways along with
> data
> from the associated relation. This is easy to implement, in the same way I
> did
> for the name:xx tags.

All of the entries in the rendering tables are linked back to a osm feature
with the osm_id. If they were derived from a relation, then the osm_id is
negative.

Kai



--
View this message in context: http://gis.19327.n5.nabble.com/osm2pgsql-support-for-local-route-names-tp5756704p5757124.html
Sent from the Developer Discussion mailing list archive at Nabble.com.



More information about the dev mailing list