Il giorno 28 marzo 2013 19:35, Groppo <grop...@gmail.com> ha scritto:
> Il giorno 28 marzo 2013 17:54, emmexx <emm...@tiscalinet.it> ha scritto: > > È stato ha proposto di segnalare solo le entrate in rotatoria, senza > turn_restriction, che hanno una strada laterale, per filtrare i casi più > importanti tipo: > ... > Nel tuo esempio, solo l'entrata che arriva dal parcheggio ha una laterale. > > Lo script però avrebbe dovuto escluderla perché la laterale è una > ciclabile, quindi... c'è qualcosa che non va (grazie per la segnalazione). > Ho fatto delle modifiche. Le entrate che hanno come unica laterale una cycleway non dovrebbero più essere segnalate. Ho escluso anche i casi in cui: - imboccare l'entrata in rotatoria sia l'unica scelta possibile ( http://osrm.at/2MV) - le laterali dell'entrata sono entranti, a senso unico. https://dl.dropbox.com/u/41550819/OSM/inversione_permessa.gpx (~1260 segnalazioni) Ciao, Groppo -- crea tabella con way entranti in rotatoria senza turn sul primo nodo DROP TABLE IF EXISTS all_roundabout_entry_without_turn; CREATE TABLE all_roundabout_entry_without_turn AS SELECT w2.id AS entry_id FROM ways AS w1, ways AS w2, junctions AS j1, junctions AS j2 WHERE w1.nodes[1] = j1.node_id AND w1.nodes[array_upper(w1.nodes, 1)] = w2.nodes[1] AND w2.nodes[array_upper(w2.nodes, 1)] = j2.node_id AND j1.id = j2.id AND NOT w1.tags ? 'junction' AND NOT w2.tags ? 'junction' AND w1.tags -> 'oneway' <> 'no' AND w2.tags -> 'oneway' <> 'no' AND w2.nodes[1] NOT IN (SELECT member_id FROM relation_members WHERE member_type = 'N'); CREATE INDEX ON all_roundabout_entry_without_turn (entry_id); ANALYZE all_roundabout_entry_without_turn; -- crea tabella con nodi delle way entranti, tranne primo ed ultimo DROP TABLE IF EXISTS all_roundabout_entry_without_turn_nodes; CREATE TABLE all_roundabout_entry_without_turn_nodes AS SELECT unnest(w.nodes[2:array_upper(w.nodes, 1)-1]) AS nid, e.entry_id AS entryid FROM all_roundabout_entry_without_turn AS e, ways AS w WHERE w.id = e.entry_id; CREATE INDEX ON all_roundabout_entry_without_turn_nodes (nid, entryid); ANALYZE all_roundabout_entry_without_turn_nodes; -- trova primo nodo delle way entranti che hanno nodi appartenenti a più way -- laterali, non entranti ed a senso unico DROP TABLE IF EXISTS turn_errors; CREATE TABLE turn_errors AS SELECT w.nodes[1] AS id FROM ways AS w JOIN ( SELECT e.entryid AS id FROM way_nodes, all_roundabout_entry_without_turn_nodes AS e, ways AS lat WHERE node_id = e.nid AND way_id = lat.id AND lat.tags -> 'highway' NOT IN ('footway', 'path', 'cycleway') AND lat.id <> e.entryid AND CASE WHEN NOT lat.tags ? 'oneway' THEN TRUE WHEN lat.tags -> 'oneway'='no' THEN TRUE WHEN lat.tags -> 'oneway'='yes' THEN sequence_id = 0 WHEN lat.tags -> 'oneway' = '-1' THEN sequence_id = array_upper(lat.nodes, 1) -1 END GROUP BY e.entryid ORDER BY e.entryid ) AS wrong_entry ON (wrong_entry.id = w.id); CREATE INDEX ON turn_errors (id); ANALYZE turn_errors; -- rimuovi casi in cui imboccare l'entrata sia l'unica scelta possibile DROP TABLE IF EXISTS roundabout_entry_without_turn; CREATE TABLE roundabout_entry_without_turn AS SELECT 'n'||n.id AS osmid, 'no turn' AS desc, n.geom AS geometry FROM nodes AS n WHERE n.id IN (SELECT wn.node_id FROM way_nodes AS wn JOIN turn_errors AS error ON (error.id = wn.node_id) GROUP BY wn.node_id HAVING Count(wn.node_id) > 2);
_______________________________________________ Talk-it mailing list Talk-it@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk-it