[pgrouting-users] Cleaning multilinestring vector network for routing via kDijkstra

AUS - Eyad b00038807 at aus.edu
Mon Dec 15 11:35:24 PST 2014

Thanks Steve..

I tried using st_geometryn as follows:

    'SELECT id, source, target, (st_length(ST_GeometryN(geom,1)) * 0.001) as
cost FROM schema.table',
    id, (SELECT array_agg(id) FROM schema.table), false, false
  ) as cost
from schema.table

I got exactly same results as before.. Cost="-1" which means that there is
no connection

Looking forward for further assistance ASAP



-----Original Message-----
From: pgrouting-users-bounces at lists.osgeo.org
[mailto:pgrouting-users-bounces at lists.osgeo.org] On Behalf Of Stephen
Sent: Monday, December 15, 2014 10:45 PM
To: pgrouting-users at lists.osgeo.org
Subject: Re: [pgrouting-users] Cleaning multilinestring vector network for
routing via kDijkstra


There has recently been a bug reported against pgr_nodeNetwork and it 
contains a patch to fix that problem. See:

If you have multilinestrings then you might want to try something like:

st_geometryn(multiline, 1)

so you just select the first linestring in the multilinestring.


On 12/15/2014 12:24 PM, AUS - Eyad wrote:
> Hi All,
> As I'm still struggling to make my network routable, I tried using
> pgr_nodeNetwork (instead of using v.clean), as follows:
> Select pgr_nodeNetwork ('schema.table', 0.0001, 'id', 'geom')
> But I got the following Error:
> line_locate_point: 1st arg isnt a line
> CONTEXT: SQL statement "create temp table inter_loc on commit drop as (
> select * from (
> (select l1id, l2id, st_linelocatepoint(line,source) as locus from
> union
> (select l1id, l2id, st_linelocatepoint(line,target) as locus from
> intergeom)) as foo
> where locus<>0 and locus<>1)"
> PL/pgSQL function pgr_nodenetwork(text,double precision,text,text,text)
> line 184 at EXECUTE statement
> I removed line 184 from my table but still getting same Error!
> Afterward, I tried calculating the costs using pgr_kdijkstraCost, but
> unfortunately most of the results are "-1" which means that there is no
> connection!
> Important note: my network is somehow accurate (done on CAD), but I
> think this is a normal cleaning that every expert of you may take it for
> granted
> Please assist in resolving this issue (even by suggesting new
> tool/function) because my time is becoming tight and this is my first
> real/full application using pgRouting
> Regards,
> Eyad
> *From:*AUS - Eyad [mailto:b00038807 at aus.edu]
> *Sent:* Monday, December 15, 2014 12:44 AM
> *To:* 'pgRouting users mailing list'
> *Subject:* Cleaning multilinestring vector network for routing via
> Hi All,
> I'm facing a serious issue preparing my multilinestring vector network
> for routing.
> I imported my vector network from CAD file. Obviously, there are some
> areas where lines are intercrossing still not routable_through;
> although, they are connected to each others!
> I used V.Clean (advance) to clean the network before importing to the
> database. I tried (break, snap, bpol, etc) alternatively but still not
> sure which one is the proper tool. Also I'm finding it hard to set the
> parameters because my vector network is obviously imported in
> millimeters while the network is spread on a length reaching 700m from
> start to destination from some ends.
> I'm testing the results via shortest_path plugin before I import to
> DataBase. In few successful cases using shortest_path, afterwards the
> network gets to lose a lot of elements while importing to DB (i.e. 600
> features only written from 700).
> If there are other ways to make the network clean and routable, please
> suggest
> I'm using QGIS 2.4.0 and pgRouting pg93-binaries-2.4.0
> Regards..
> Eyad
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users

Pgrouting-users mailing list
Pgrouting-users at lists.osgeo.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4235/8736 - Release Date: 12/14/14

More information about the Pgrouting-users mailing list