12 votes
Accepted

How do PostGIS functions handle buffers and external storage?

No, most of these "higher order analysis" functions do not have any special handling for data sets that are larger than can fit in memory. If you run them on such data sets, you'll just OOM the ...
Paul Ramsey's user avatar
  • 19.8k
11 votes
Accepted

PgRouting : Shortest path starting from the closest vertex not the closest node

While still not in the official release, the withPoints family of functions is in a stable state since pgRouting 2.2 (?) and provides a dynamic interface for temporary nodes in a graph, i.e. routing ...
geozelot's user avatar
  • 29.8k
9 votes
Accepted

How are cost and reverse cost computed in pgrouting?

For osm2pgrouting V2.1: length is length of the segment in degree units cost and reverse_cost is the length in degree units. (include the negative values for wrong way) length_m is in meters (there ...
Vicky's user avatar
  • 439
9 votes

Wrong shortest path using pg routing

The two lookup points you pass into the (K)NN sub-queries can't be referenced in EPSG:3857 - their coordinate values seem to be in degree and are likely EPSG:4326! Assuming planet_osm_roads.way has ...
geozelot's user avatar
  • 29.8k
8 votes
Accepted

pgr_createTopology with large datasets

The following is what I am using. Some of it is specific to our deployment environment since we are using docker and some bash scripts to deploy and set up the server. You could easily get rid of all ...
James's user avatar
  • 326
7 votes

Why is any pgr_* routing function taking forever based on OSM data in an pgrouting enabled DB

Use this guide to set up indexes for a spatial database. Here is the gist of it: 1. create indexes on ID, source and target columns. 2. create index using GIST on geom column. 3. vacuum 4. ...
kttii's user avatar
  • 3,610
6 votes
Accepted

pgrouting no result // topology problem

EDIT 3: After a long discussion in the comments I reviewed my answer, taking the sample data and it´s upload into PostgreSQL from within QGIS into account. I deleted my EDIT 2 as it became useless. ...
geozelot's user avatar
  • 29.8k
6 votes

Multiple shortest paths with pgRouting using a list as a secondary table

You want to simply run that function on every row in the <list> table; generally speaking, this is no different than any other function applied to a column/row. In practice, this here is a ...
geozelot's user avatar
  • 29.8k
6 votes

Dashed lines in pgRouting

The reason for these kind of errors is ususally a wrong network topology. In particular you must make sure, that you use the correct unit (meter or degree) for the tolerance value in the ...
dkastl's user avatar
  • 4,786
6 votes
Accepted

pgr_dijkstra is considering one-way streets as bidirectional

You are passing in the metric length ST_Length(geom::GEOGRAPHY) of each edge E as both cost & reverse_cost - rendering it equal to to the undirected counterpart. pgRouting realizes ordered graph ...
geozelot's user avatar
  • 29.8k
6 votes
Accepted

Is the geometry type of PostGIS represented as WKT or just the Point type?

PostGIS internally stores geometry data as binary objects which are optimized for scanning and processing. Geometry objects include the SRID. WKT, EWKT, WKB and EWKB are just representations for ...
dr_jts's user avatar
  • 4,968
6 votes

Calculating cost values in pgRouting using ST_DWithin

You should simply UPDATE utrecht_osm_foot_2po_4pgr_duplicate SET cost_greenery = cost / 1000 WHERE ST_DWithin(geom_way, osm_meta, 30) ; If no update happened make sure your geometries have a ...
geozelot's user avatar
  • 29.8k
6 votes

pg_routing error when generating alpha shapes

Note that pgr_pointsAsPolygon has been moved to legacy as of pgRouting 3.0.0 - I won't address this function. Read the docs carefully; the full function signature pgr_alphaShape(geometry, [...
geozelot's user avatar
  • 29.8k
5 votes

How to install pgRouting in Ubuntu 14.04?

sudo apt-add-repository -y ppa:ubuntugis/ppa sudo apt-add-repository -y ppa:georepublic/pgrouting sudo apt-get update sudo apt-get install postgresql-9.3-pgrouting Now you should be able to add the ...
Wolfi's user avatar
  • 151
5 votes

Creating drive time polygons using Open Source tools?

You might want to check out the open Route360° JavaScript API, which works with both Leaflet and Google maps. It returns travel time polygons for the following travel modes: walk, bike, car, transit. ...
5 votes

pgr_dijkstra function with geometry column in result

Join to table ways is as for now only solution (BTW recommended in all official documentation and workshops)
Jendrusk's user avatar
  • 2,617
5 votes
Accepted

Unable to create topology with pgrouting

Add source and target columns to your table.
Michal Zimmermann's user avatar
5 votes

win10/CREATE EXTENSION Pgrouting--could not access file "$libdir/libpgrouting-2.3"

This sounds like you are using the BigSQL distribution. Do not use the installers for that since the PostgreSQL folder layout of BigSQL is different from PostgreSQL EDB distribution (which is what ...
Regina Obe's user avatar
  • 10.5k
5 votes

Setting up pgRouting

You are trying to follow instructions from 2011. They don't apply to current versions of PostGIS/PgRouting. Instead, just do CREATE EXTENSION Postgis; CREATE EXTENSION pgrouting; PgRouting should ...
underdark's user avatar
  • 84k
5 votes
Accepted

Problem using pgr_createTopology

The geometrytype should be LineString, not LineStringM. Try changing your geom column to LineString with this: ALTER TABLE public.roads ALTER COLUMN geom TYPE geometry(LineString,3006) USING ...
Regina Obe's user avatar
  • 10.5k
5 votes
Accepted

pgrouting with oneway

You would need to prepare your data beforehand. Add cost and reverse_cost columns to your ways_noded table. Then, you populate them using the way length if usable in this direction, or an insanely ...
JGH's user avatar
  • 41.6k
5 votes

Shortest paths between points over multiple linestrings

As you already pointed out, this indeed can be solved with pgRouting and will have to be added to your database as an extension. You will have to do some preparations with the data to get it going. ...
Timothy Dalton's user avatar
4 votes

What is an undirected graph with cost and reverse cost?

Maybe the documentation at http://docs.pgrouting.org/dev/src/dijkstra/doc/index.html#pgr-dijkstra can shed some light onto the isse. It would seem like - in an undirected graph - one can go in either ...
underdark's user avatar
  • 84k
4 votes

Assign_vertex_id function does not exist

I am running pgrouting version 2.0.0, and assign_vertex_id or pgr_assign_vertex_id doesn't exist. To build the topology, I use the function pgr_createtopology. In your case, you could go like this: ...
CptGasse's user avatar
  • 141
4 votes
Accepted

How to use pgr_dijkstra many-to-many

You don't need the SELECT of the array, just return the array of the SELECT (in other words, remove the "select"): SELECT * FROM pgr_dijkstraCost( 'select id, source, target, cost, reverse_cost ...
kttii's user avatar
  • 3,610
4 votes

Add one-way streets to network data in postgis

In pgRouting the direction is always from source to target. When you run pgr_createTopology(), then source is the start point of your line geometry and target is the end point. If you want to model ...
dkastl's user avatar
  • 4,786
4 votes
Accepted

How can I get the length of segments from the output of pgr_dijkstra?

pgr_dijkstra(edges_sql, start_vid, end_vid, directed:=true ) is a SQL function. It returns the following, regardless of what you input into its TEXT edges_sql argument. RETURNS SET OF (seq, path_seq,...
raphael's user avatar
  • 3,387
4 votes

How to give start and end vertex ids dynamically in pgr_dijkstra?

You can use the array() function around a SELECT statement to pass in multiple vertex IDs. See example below: SELECT ( SUM(w.km)*0.621371 ) As miles,r.start_vid,r.end_vid FROM pgr_dijkstra('...
kttii's user avatar
  • 3,610
4 votes

pgr_createTopology - how tolerance?

I guess that you took the example createTopology function which is shown for WGS84 geometries, using degrees as a projection unit. 0.00001 degree tolerance means that your points have to be less than ...
Vincent Monteil's user avatar
4 votes
Accepted

Using pgRouting for 'multiple pedestrians' on an existing table of 'students'?

It seems that the problem is with the the multi-student sub-query below you were using to replace the single student query: --student (SELECT id FROM osm.osm_ways_vertices_pgr ORDER BY the_geom <-&...
tinlyx's user avatar
  • 11.1k

Only top scored, non community-wiki answers of a minimum length are eligible