I'm following the instrcutions here step by step;
Since my data is a custom road data that I couldn't find in Open Street Map I've followed these steps;
- Road data in SHP format transferred to PostgreSQL using Postgis Shapefile Loader.
- MULTISTRINGLINE data transformed to LINESTRING
- Topology created for the data using pgr_createtopology function
- Topology analyzed using pgr_analyzeGraph function
- Errors found in analyze are fixed using pgr_nodeNetwork function
- Topology recreated with new data table and analysis have been done similarly to first and second steps.
The problem starts from here; in documentation it says a column named old_id should be added to data table to keep track of original id's. Only segmented edges are added to table using the SQL statement;
insert into edge_table (old_id,dir,cost,reverse_cost,the_geom) (with segmented as (select old_id,count(*) as i from edge_table_noded group by old_id) select segments.old_id,dir,cost,reverse_cost,segments.the_geom from edge_table as edges join edge_table_noded as segments on (edges.id = segments.old_id) where edges.id in (select old_id from segmented where i>1) );
When I run the statement above I get this error;
ERROR: column "cost" of relation "path" does not exist
In fact none of the functions I've runned while creating the nodes adds a cost column to data table. Should I add cost manually? If so how can this be done ? Documentation doesn't mention about cost. It sounds like it is automatically generated like the other columns such as source and target.