Geographic Information Systems Asked on March 11, 2021
Versions
PostGIS Bundle 3 for PostgreSQL x64 12
pgAdmin 4.24
pgrouting 3.1.0
I have also enabled the postgis
and pgrouting
extensions on a public
schema.
I am only just starting with pgrouting so I am new to all the concepts. I am trying to follow a tutorial from pgrouting.org to find the shortest path between points on a network. I have created a table with their sample data and inserted the values. I have created the edge table using:
CREATE TABLE edge_table (
id BIGSERIAL,
dir character varying,
source BIGINT,
target BIGINT,
cost FLOAT,
reverse_cost FLOAT,
capacity BIGINT,
reverse_capacity BIGINT,
category_id INTEGER,
reverse_category_id INTEGER,
x1 FLOAT,
y1 FLOAT,
x2 FLOAT,
y2 FLOAT,
the_geom geometry
INSERT INTO edge_table (
category_id, reverse_category_id,
cost, reverse_cost,
capacity, reverse_capacity,
x1, y1,
x2, y2) VALUES
(3, 1, 1, 1, 80, 130, 2, 0, 2, 1),
(3, 2, -1, 1, -1, 100, 2, 1, 3, 1),
(2, 1, -1, 1, -1, 130, 3, 1, 4, 1),
(2, 4, 1, 1, 100, 50, 2, 1, 2, 2),
(1, 4, 1, -1, 130, -1, 3, 1, 3, 2),
(4, 2, 1, 1, 50, 100, 0, 2, 1, 2),
(4, 1, 1, 1, 50, 130, 1, 2, 2, 2),
(2, 1, 1, 1, 100, 130, 2, 2, 3, 2),
(1, 3, 1, 1, 130, 80, 3, 2, 4, 2),
(1, 4, 1, 1, 130, 50, 2, 2, 2, 3),
(1, 2, 1, -1, 130, -1, 3, 2, 3, 3),
(2, 3, 1, -1, 100, -1, 2, 3, 3, 3),
(2, 4, 1, -1, 100, -1, 3, 3, 4, 3),
(3, 1, 1, 1, 80, 130, 2, 3, 2, 4),
(3, 4, 1, 1, 80, 50, 4, 2, 4, 3),
(3, 3, 1, 1, 80, 80, 4, 1, 4, 2),
(1, 2, 1, 1, 130, 100, 0.5, 3.5, 1.999999999999,3.5),
(4, 1, 1, 1, 50, 130, 3.5, 2.3, 3.5,4);
At this point I have created the geometry using:
UPDATE edge_table SET the_geom = st_makeline(st_point(x1,y1),st_point(x2,y2))
After that I create some topology with :
SELECT pgr_createTopology('edge_table',0.001);
Then I try to use the pgr_dijkstra() function and it’s at this point the wheels come off.
The textbook I’m following gives the following input as an example:
SELECT pgr_dijkstra('SELECT id, source, target, cost FROM edge_table', 16,9,false,false);
But it throws this error.
ERROR: function pgr_dijkstra(unknown, integer, integer, boolean, boolean) does not exist
LINE 1: SELECT pgr_dijkstra('SELECT id, source, target, cost FROM ed...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 8
The table
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP