[OSM-talk] Osm2pgsql/TileMill - how to detect whether way is in a route?

Frederik Ramm frederik at remote.org
Tue Mar 19 01:57:00 UTC 2013


Hi,

On 19.03.2013 00:52, Steve Bennett wrote:
> So I'm just wondering if there is a way around this - some setting in
> osm2pgsql, some SQL magic I could play with.

It will be very slow magic, but two things come to mind:

One would use the line geometry table and ask for routes in the vicinity 
to be subtracted from the way geometry; if the resulting geometry is 
empty then your way was part of a route. In pseudo SQL something like

select way,attribute,attribute,attribute,st_isempty(st_difference(way, 
(select way from planet_osm_roads t2 where t2.osm_id<0 and 
t2.has_mtb_route_tags and t2.way && way) as in_mtb_route from 
planet_osm_ways...

The other would be using the planet_osm_rels table that only exists ins 
slim mode and from there get a list of all relations the way in question 
is a member of, check those relations for mtb routes...

The only *efficient* way I can think of is extending osm2pgsql so that 
it sets an extra flag for ways that are part of a route relation.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"



More information about the talk mailing list