Additionally, I restricted the respective nodes to the lattitude longitude for the Säntis region.
These ways are kept in a specific table:
create table 
   sac_ways_around_saentis as
 select distinct 
   wy.id  way_id
 from
   tag          tg                        join
   way          wy on wy.id = tg.way_id   join
   node_in_way  nw on wy.id = nw.way_id   join
   node         nd on nd.id = nw.node_id
 where
   nd.lat > 47.2210118322 and 
   nd.lat < 47.2604651483 and
   nd.lon >  9.3149215728 and
   nd.lon <  9.3959004678 and
   tg.k   = 'sac_scale'
With this table, I can now extract the lattitude/longitude pairs for each node in the relevant ways and write them into a kml file.
The algorithm basically boils down to:
select way_id from sac_ways_around_saentis
  -- with each way_id:
  select node_id from node_in_way where way_id = ? order by order_
  -- with node_id
     select lat, lon from node where id = ?
     -- Emit lat, lon into kml file
Of course, I would use a Python script for this (sac_ways_saentis.py on github).
Here's a screen shot of the result:
 
 
No comments:
Post a Comment