Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Views on relations #1

Open
sigfrido opened this issue Jan 22, 2015 · 0 comments
Open

Views on relations #1

sigfrido opened this issue Jan 22, 2015 · 0 comments
Assignees

Comments

@sigfrido
Copy link
Member

Allow user to define views on relations.
We should be able to specify geometry (multilinestring, multipoint or geometrycollection), and which roles to include in the geometry collection.

An example for routes:

CREATE OR REPLACE VIEW osm_views.routes AS
SELECT r.id,
g.geom,
r.tags -> 'ref'::text AS ref,
r.tags -> 'route'::text AS route,
r.tags -> 'from'::text AS inizio,
r.tags -> 'to'::text AS fine,
r.tags -> 'name'::text AS nome,
r.tags -> 'operator'::text AS operator,
r.tags -> 'network'::text AS network,
r.tags
FROM relations r
LEFT JOIN ( SELECT m.relation_id,
st_collect(w.linestring) AS geom
FROM relation_members m
LEFT JOIN ways w ON m.member_type = 'W'::bpchar AND m.member_id = w.id
GROUP BY m.relation_id) g ON r.id = g.relation_id
WHERE (r.tags -> 'type'::text) = 'route'::text
ORDER BY r.tags -> 'ref'::text;

@sigfrido sigfrido self-assigned this Jan 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant