Untitled


SUBMITTED BY: Guest

DATE: April 18, 2013, 4:50 a.m.

FORMAT: Text only

SIZE: 751 Bytes

HITS: 1794

  1. gis=# explain analyze
  2. SELECT
  3. AsText("way") AS geom,
  4. "ref"
  5. from (
  6. select
  7. way,
  8. array_to_string(array(select * from unnest(array_agg(ref)) order by 1), ', ') as ref
  9. from (
  10. select distinct on (w.way,ref)
  11. unnest(string_to_array(r.ref, ';')) as ref,
  12. w.way as way
  13. from
  14. planet_osm_line w, planet_osm_line r
  15. where
  16. (r.route='train' or r.route='railway' or r.line='rail')
  17. and (w.osm_id > 0) and (r.osm_id < 0)
  18. and ST_Within(w.way,r.way)
  19. ) lines
  20. group by way
  21. ) as routes
  22. WHERE "way" && SetSRID('BOX3D(-6506931.343860455 -4139217.955698919,-6495924.411787389 -4128211.023625853)'::box3d, 900913);

comments powered by Disqus