Forum #23 - Topic #45 - Message List
Topology of Road Map is some directed streets and some other is non-directed. How to design a database Topo for directed shortest path. If a street is non-directed, can i copy it and reverse source to target and on the contrary?While directed streets keep intact.By that way, database will increase and create identical on db. tell me about this problem? thanks.
-
Message #160
Topology of Road Map is some directed streets and some other is non-directed. How to design a database Topo for directed shortest path. If a street is non-directed, can i copy it and reverse source to target and on the contrary?While directed streets keep intact.By that way, database will increase and create identical database. tell me about this problem? thanks.
09/13/07 18:53:18 -
Message #162
Hi,
So, as I could understand, directed edges in your dataset represent one way streets and undirected edges represent both ways streets. If it is so, you don't need to worry - just add 'reverse_cost' column to describe directed edge length. And for undirected edges the values of 'length' and 'reverse_cost' columns should be equal.
anton09/14/07 09:45:40 -
Message #163
Thanks Anton so much!!!
But how should 'reverse_cost' column of directed edges set? reverse_cost column is represent length of contrariwise direction ? Like this, attribute directed (bool) in functions to find shortest_path is false or true.What mean Directed variable in this case? When can i use it and set it is 'true' ?
09/14/07 10:53:24 -
Message #164
Did you read OneWayStreets page already?
anton09/14/07 11:12:22 -
Message #165
I read it ago but do Anton see edge 3->5 can't go 5->3, while that exemple is wrong. there are a line 5->3, b/c i can understand how is accurate.
09/14/07 11:53:35 -
Message #166
The image “http://files.orkney.jp/pgrouting/img/howto_onewaystreets_1.png” I thought reverse_cost column only use to special streets( forbade streets). There are not ex: if i want go from 3 to 1, can i go from 1->2 with topo like it. I will try it but i want to a clearly show.
09/14/07 12:55:54 -
Message #168
I'm not sure I understood you well...
At the OneWayStreets example you spend 'cost' value for going 3->5 and 'reverse_cost' value for 5->3. The 'reverse_cost' value can be very hight in case of one way street or comparable with 'cost' value in case of, let's say, mountain street where you have to spend more time going uphill.
anton09/14/07 13:18:28 -
Message #169
Thank you for your aim to help improving pgRouting! But I had to roll back your edits on the wiki page, because it was the completely wrong place to add some content. The start page of the Wiki is not the place to add further comments. Instead it would be better to create a new Wiki page and link it with the documentation.
Also we can't accept installer files without knowing what is inside or at least together with some readme file. Same as above this would be better placed somewhere else in the Wiki.
Though I don't want to discourage you to join the developer community, but we should try to keep the Wiki organized.
If you don't know where to place your contribution, feel free to ask or just create a separate Wiki page and I will move it to the right place.
Daniel
daniel09/14/07 15:50:17 -
Message #170
Hi Daniel! Sorry about that, Why do you not create user name and password that there are a decentralization? I saw Edit and Attach file on home page and i can use it,i subrised about that.I will find another place to post.
Hi auton! I created database like OneWayStreet? example. I try it, i undertanded about that.However,it isn't right in OneWayStreet?. If you find route from 5->1 it will pass edges: 4->3->1 (vertexs 5->4->2->1) instead of pass edges: 5->2->1( vertexs : 5->3->2->1) is shorter.
09/14/07 16:32:10 -
Message #171
Did you try that way from 5 to 1 by yourself? Can you post here your cost and reverse cost values for all edges?
anton09/14/07 17:33:27 -
Message #172
--Here code data base and Test -- PostgreSQL database dump --
-- Started on 2007-09-14 15:47:40
SET client_encoding = 'SQL_ASCII'; SET standard_conforming_strings = off; SET check_function_bodies = false; SET client_min_messages = warning; SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = ;
SET default_with_oids = false;
-- -- TOC entry 3148 (class 1259 OID 52496) -- Dependencies: 3534 3535 3536 4 1671 -- Name: tempstreets; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --
CREATE TABLE tempstreets (
gid integer NOT NULL, objectid integer, x1 numeric, y1 numeric, x2 numeric, y2 numeric, source integer, target integer, length numeric, the_geom geometry, reverse_cost numeric, CONSTRAINT enforce_dims_the_geom CHECK ((ndims(the_geom) = 2)), CONSTRAINT enforce_geotype_the_geom CHECK (((geometrytype(the_geom) = 'MULTILINESTRING'::text) OR (the_geom IS NULL))), CONSTRAINT enforce_srid_the_geom CHECK ((srid(the_geom) = -1))
);
ALTER TABLE public.tempstreets OWNER TO postgres;
-- -- TOC entry 3147 (class 1259 OID 52494) -- Dependencies: 3148 4 -- Name: tempstreets_gid_seq; Type: SEQUENCE; Schema: public; Owner: postgres --
CREATE SEQUENCE tempstreets_gid_seq
INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1;
ALTER TABLE public.tempstreets_gid_seq OWNER TO postgres;
-- -- TOC entry 3542 (class 0 OID 0) -- Dependencies: 3147 -- Name: tempstreets_gid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --
ALTER SEQUENCE tempstreets_gid_seq OWNED BY tempstreets.gid;
-- -- TOC entry 3543 (class 0 OID 0) -- Dependencies: 3147 -- Name: tempstreets_gid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres --
SELECT pg_catalog.setval('tempstreets_gid_seq', 5, true);
-- -- TOC entry 3533 (class 2604 OID 52498) -- Dependencies: 3148 3147 3148 -- Name: gid; Type: DEFAULT; Schema: public; Owner: postgres --
ALTER TABLE tempstreets ALTER COLUMN gid SET DEFAULT nextval('tempstreets_gid_seq'::regclass);
-- -- TOC entry 3539 (class 0 OID 52496) -- Dependencies: 3148 -- Data for Name: tempstreets; Type: TABLE DATA; Schema: public; Owner: postgres --
INSERT INTO tempstreets (gid, objectid, x1, y1, x2, y2, source, target, length, the_geom, reverse_cost) VALUES (1, 2, 589038.940000, 1213277.88100, 589074.520000, 1212165.63200, 1, 2, 1112.81879659, '010500000001000000010200000002000000CED14AE1DDF921412530A1E15D8332414100340A25FA2141B08EAAA1057F3241', 1112.81879659); INSERT INTO tempstreets (gid, objectid, x1, y1, x2, y2, source, target, length, the_geom, reverse_cost) VALUES (3, 8, 589074.520000, 1212165.63200, 589062.418000, 1211297.83900, 2, 4, 925.883791824, '010500000001000000010200000002000000C5C00A08C1132241CC99591BAB7B32414A5C8B675C142241A793C8B9457F3241', 925.883791824); INSERT INTO tempstreets (gid, objectid, x1, y1, x2, y2, source, target, length, the_geom, reverse_cost) VALUES (5, 7, 592430.202000, 1212229.72600, 592352.516000, 1211307.10700, 3, 5, 3290.11097664, '010500000001000000010200000002000000F9C7E7D50CFA2141A30CC0D6A17B3241C5C00A08C1132241CC99591BAB7B3241', 3290.11097664); INSERT INTO tempstreets (gid, objectid, x1, y1, x2, y2, source, target, length, the_geom, reverse_cost) VALUES (2, 3, 592430.202000, 1212229.72600, 589074.520000, 1212165.63200, 3, 2, 3356.29435745, '0105000000010000000102000000020000004100340A25FA2141B08EAAA1057F32414A5C8B675C142241A793C8B9457F3241', 13356.29435745); INSERT INTO tempstreets (gid, objectid, x1, y1, x2, y2, source, target, length, the_geom, reverse_cost) VALUES (4, 5, 589062.418000, 1211297.83900, 592352.516000, 1211307.10700, 4, 5, 867.877024313, '0105000000010000000102000000020000004100340A25FA2141B08EAAA1057F3241F9C7E7D50CFA2141A30CC0D6A17B3241', 867.877024313);
-- -- TOC entry 3538 (class 2606 OID 52503) -- Dependencies: 3148 3148 -- Name: tempstreets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --
ALTER TABLE ONLY tempstreets
ADD CONSTRAINT tempstreets_pkey PRIMARY KEY (gid);
-- Completed on 2007-09-14 15:47:41
SELECT * FROM shortest_path_astar('SELECT gid AS id, source::int4,
target::int4, length::double precision AS cost,reverse_cost::double precision
AS reverse_cost, x1, y1, x2, y2 FROM tempstreets',5, 1, false, true);
09/14/07 17:54:16

