<div dir="ltr"><div>Dimenticavo la query. Probabilmente è intutilmente complicata ma... sembra funzionare.<br></div><div><br>--tabella con way entranti in rotatoria senza turn sul primo nodo<br>DROP TABLE IF EXISTS all_roundabout_entry_without_turn;<br>
CREATE TABLE all_roundabout_entry_without_turn AS<br>SELECT <a href="http://w2.id">w2.id</a> AS id<br>FROM ways AS w1, ways AS w2, junctions AS j1, junctions AS j2<br>WHERE<br>w1.nodes[1] = j1.node_id AND<br>w1.nodes[array_upper(w1.nodes, 1)] = w2.nodes[1] AND<br>
w2.nodes[array_upper(w2.nodes, 1)] = j2.node_id AND<br><a href="http://j1.id">j1.id</a> = <a href="http://j2.id">j2.id</a> AND<br>NOT w1.tags ? 'junction' AND<br>NOT w2.tags ? 'junction' AND<br>w1.tags -> 'oneway' <> 'no' AND<br>
w2.tags -> 'oneway' <> 'no' AND<br>w2.nodes[1] NOT IN (SELECT member_id<br>FROM relation_members WHERE member_type = 'N');<br>CREATE INDEX ON all_roundabout_entry_without_turn (id);<br>ANALYZE all_roundabout_entry_without_turn;<br>
-- crea tabella con nodi delle way entranti, tranne primo ed ultimo<br>DROP TABLE IF EXISTS all_roundabout_entry_without_turn_nodes;<br>CREATE TABLE all_roundabout_entry_without_turn_nodes AS<br>SELECT unnest(w.nodes[2:array_upper(w.nodes, 1)-1]) AS nid, <a href="http://e.id">e.id</a> AS wid<br>
FROM all_roundabout_entry_without_turn AS e, ways AS w<br>WHERE <a href="http://w.id">w.id</a> = <a href="http://e.id">e.id</a>;<br>CREATE INDEX ON all_roundabout_entry_without_turn_nodes (nid, wid);<br>ANALYZE all_roundabout_entry_without_turn_nodes;<br>
-- trova primo nodo delle way entranti che hanno nodi che appartengono a più way<br>DROP TABLE IF EXISTS roundabout_entry_without_turn;<br>CREATE TABLE roundabout_entry_without_turn AS<br>SELECT 'n'||<a href="http://nodes.id">nodes.id</a> AS osmid, 'no turn' AS desc, nodes.geom AS geometry<br>
FROM nodes, ways AS w, all_roundabout_entry_without_turn_nodes AS e<br>JOIN (SELECT e.nid AS nid<br> FROM way_nodes, all_roundabout_entry_without_turn_nodes AS e, ways AS w<br> WHERE node_id = e.nid AND<br> <a href="http://w.id">w.id</a> = way_nodes.way_id AND<br>
w.tags -> 'highway' NOT IN ('footway', 'cycleway', 'path')<br> GROUP BY e.nid, e.wid HAVING Count(e.nid) > 1) AS l ON (l.nid = e.nid)<br>WHERE<br><a href="http://nodes.id">nodes.id</a> = w.nodes[1] AND<br>
<a href="http://w.id">w.id</a> = e.wid<br>GROUP BY <a href="http://nodes.id">nodes.id</a>;<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">Il giorno 27 marzo 2013 20:30, Groppo <span dir="ltr"><<a href="mailto:groppo8@gmail.com" target="_blank">groppo8@gmail.com</a>></span> ha scritto:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Il giorno 27 marzo 2013 10:42, Aury88 <span dir="ltr"><<a href="mailto:spacedriver88@gmail.com" target="_blank">spacedriver88@gmail.com</a>></span> ha scritto:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">...<div class="im"><br>
intendevo che potremmo filtrare e togliere dal report le strade che hanno<br></div>
solo tre nodi in comune con altre strade. ...(naturalmente do per scontato che si parli di sole highway<div class="im"><br>
percorribili dalle macchine...capita spesso che vi siano passaggi pedonali e<br>
quindi highway=footway o altro che attraversano i raccordi e questi non<br>
dovrebbero venire contati)<br></div></blockquote><div><br></div><div>Mi sembra una buona idea, ho cercato le way che soddisfano queste condizioni.<br><br>Riassumendo:<br>"entrate in rotatoria che hanno una strada laterale (non footway ecc...)"<br>
nel cui primo nodo è quindi utile aggiungere l'oobbligo di proseguire dritti per chi proviene dall'uscita della rotatoria.<br><br>Risultano 1567 way.<br>Ci sono dei falsi positivi ma anche molti casi interessanti, da correggere:<br>
<a href="http://www.openstreetmap.org/browse/node/2122715707" target="_blank">http://www.openstreetmap.org/browse/node/2122715707</a><br><a href="http://www.openstreetmap.org/browse/node/806490" target="_blank">http://www.openstreetmap.org/browse/node/806490</a><br>
<a href="http://www.openstreetmap.org/browse/node/2104491729" target="_blank">http://www.openstreetmap.org/browse/node/2104491729</a><br><a href="http://www.openstreetmap.org/browse/node/130097211" target="_blank">http://www.openstreetmap.org/browse/node/130097211</a><br>
<a href="http://www.openstreetmap.org/browse/node/51524726" target="_blank">http://www.openstreetmap.org/browse/node/51524726</a><br><br>File GPX:<br><a href="https://dl.dropbox.com/u/41550819/OSM/direzione_obbligata_mancante.gpx" target="_blank">https://dl.dropbox.com/u/41550819/OSM/direzione_obbligata_mancante.gpx</a><br>
<br>Se mi votate la fiducia, aggiungo le segnalazioni alla pagina nel prossimo aggiornamento.<br><br><br>Ciao,<br>Groppo</div></div></div></div>
</blockquote></div><br></div>