hi im following this tutorial http://workshops.boundlessgeo.com/tutorial-routing/ of which im now in the part where i need to make an sql view for the shortest path. but ive been into postgresql for a few months. but i cant seem to understand the purpose of the Percent(%) signs on the attached code snippet below. ive looked around for it but ive only seen things talking about this :: and less on % signs. anyway here is the snippet. cause i cant seem to make it run.
SELECT
min(r.seq) AS seq,
e.old_id AS id,
e.name,
e.type,
e.oneway,
sum(e.time) AS time,
sum(e.distance) AS distance,
ST_Collect(e.the_geom) AS geom
FROM
pgr_dijkstra(
'SELECT
id,
source::INT4,
target::INT4,
%cost% AS cost,
CASE oneway
WHEN ''yes'' THEN -1
ELSE %cost%
END AS reverse_cost
FROM edges_noded', %source%, %target%, true) AS r,
edges_noded AS e
WHERE
r.id2 = e.id
GROUP BY
e.old_id, e.name, e.type, e.oneway
its a postgresql code.
Those are placeholders used by GeoServer during creation of view. They will be replaced by whatever you input in said application.
If you aren't using GeoServer, then maybe try using his earlier example with hardcoded values:
%cost% -> time
%source% -> 753
%target% -> 756
or later:
%cost% -> time
%source% -> 100
%target% -> 1000
Unrelated, but doing JOINs by comma separating tables in FROM clause and then listing conditions in WHERE is outdated and not recommended.