Commit 225bda23 authored by Jean-Benoist Leger's avatar Jean-Benoist Leger

edges with some double

parent 5953204b
......@@ -19,7 +19,6 @@ BEGIN;
-- rv_edges
DROP TABLE IF EXISTS rv_edges;
CREATE TABLE rv_edges (from_id BIGINT, to_id BIGINT, way_id BIGINT);
ALTER TABLE rv_edges ADD CONSTRAINT pk_rv_edges PRIMARY KEY (from_id,to_id,way_id);
CREATE INDEX idx_rv_edges_from_id ON rv_edges USING btree (from_id);
CREATE INDEX idx_rv_edges_way_id ON rv_edges USING btree (way_id);
......
......@@ -45,19 +45,20 @@ CREATE FUNCTION compute_edges_for_one_way(BIGINT) RETURNS INTEGER AS $$
{
my $old=$nodeid;
$nodeid = $res2->{rows}[$rn2]{node_id};
if($old>=0)
if($old!=$nodeid)
{
if($sens>=0)
if($old>=0)
{
spi_exec_query("DELETE FROM rv_edges WHERE (from_id,to_id,way_id)=($old,$nodeid,$wayid);");
spi_exec_query("INSERT INTO rv_edges (from_id,to_id,way_id) VALUES ($old,$nodeid,$wayid);");
}
if($sens<=0)
{
spi_exec_query("DELETE FROM rv_edges WHERE (from_id,to_id,way_id)=($nodeid,$old,$wayid);");
spi_exec_query("INSERT INTO rv_edges (from_id,to_id,way_id) VALUES ($nodeid,$old,$wayid);");
}
if($sens>=0)
{
spi_exec_query("INSERT INTO rv_edges (from_id,to_id,way_id) VALUES ($old,$nodeid,$wayid);");
}
if($sens<=0)
{
spi_exec_query("INSERT INTO rv_edges (from_id,to_id,way_id) VALUES ($nodeid,$old,$wayid);");
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment