<div dir="ltr">Hi Eyad,<div><br></div><div>As Steve already said, multilinestrings are not really something good for pgRouting.</div><div>But often there are no real multilinestrings at all, and you can change the geometry type.</div><div><br></div><div>How you can test, if your network has multilinestrings and how to get rid of them (if they don't contain mutli-geometries), see this link:</div><div><a href="http://gis.stackexchange.com/questions/116414/take-from-multilinestring-the-start-end-points/116444#116444">http://gis.stackexchange.com/questions/116414/take-from-multilinestring-the-start-end-points/116444#116444</a><br></div><div><br></div><div>Also you mentioned that your network data is in unit "millimeters", and you run the topology function like:</div><div><br></div><div><font face="monospace">Select pgr_nodeNetwork ('schema.table', 0.0001, 'id', 'geom')</font><br></div><div><br></div><div>This means, that you have a snapping tolerance of 0.0001 mm if your network is not properly digitized. I would assume that CAD data is correct, but still a snapping tolerance of 0.0001mm is so small, that you could just increase it to 1 for example, or even higher. Check, if in your network edges are really connected.</div><div><br></div><div>Daniel</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 16, 2014 at 4:35 AM, AUS - Eyad <span dir="ltr"><<a href="mailto:b00038807@aus.edu" target="_blank">b00038807@aus.edu</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Steve..<br>
<br>
I tried using st_geometryn as follows:<br>
<br>
pgr_kdijkstraCost(<br>
'SELECT id, source, target, (st_length(ST_GeometryN(geom,1)) * 0.001) as<br>
cost FROM schema.table',<br>
id, (SELECT array_agg(id) FROM schema.table), false, false<br>
) as cost<br>
from schema.table<br>
<br>
I got exactly same results as before.. Cost="-1" which means that there is<br>
no connection<br>
<br>
Looking forward for further assistance ASAP<br>
<br>
Regards,<br>
<br>
Eyad<br>
<div><div class="h5"><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:pgrouting-users-bounces@lists.osgeo.org">pgrouting-users-bounces@lists.osgeo.org</a><br>
[mailto:<a href="mailto:pgrouting-users-bounces@lists.osgeo.org">pgrouting-users-bounces@lists.osgeo.org</a>] On Behalf Of Stephen<br>
Woodbridge<br>
Sent: Monday, December 15, 2014 10:45 PM<br>
To: <a href="mailto:pgrouting-users@lists.osgeo.org">pgrouting-users@lists.osgeo.org</a><br>
Subject: Re: [pgrouting-users] Cleaning multilinestring vector network for<br>
routing via kDijkstra<br>
<br>
Eyad,<br>
<br>
There has recently been a bug reported against pgr_nodeNetwork and it<br>
contains a patch to fix that problem. See:<br>
<a href="https://github.com/pgRouting/pgrouting/issues/280" target="_blank">https://github.com/pgRouting/pgrouting/issues/280</a><br>
<br>
If you have multilinestrings then you might want to try something like:<br>
<br>
st_geometryn(multiline, 1)<br>
<br>
so you just select the first linestring in the multilinestring.<br>
<br>
-Steve<br>
<br>
On 12/15/2014 12:24 PM, AUS - Eyad wrote:<br>
> Hi All,<br>
><br>
> As I'm still struggling to make my network routable, I tried using<br>
> pgr_nodeNetwork (instead of using v.clean), as follows:<br>
><br>
> Select pgr_nodeNetwork ('schema.table', 0.0001, 'id', 'geom')<br>
><br>
> But I got the following Error:<br>
><br>
> line_locate_point: 1st arg isnt a line<br>
><br>
> CONTEXT: SQL statement "create temp table inter_loc on commit drop as (<br>
> select * from (<br>
><br>
> (select l1id, l2id, st_linelocatepoint(line,source) as locus from<br>
intergeom)<br>
><br>
> union<br>
><br>
> (select l1id, l2id, st_linelocatepoint(line,target) as locus from<br>
> intergeom)) as foo<br>
><br>
> where locus<>0 and locus<>1)"<br>
><br>
> PL/pgSQL function pgr_nodenetwork(text,double precision,text,text,text)<br>
> line 184 at EXECUTE statement<br>
><br>
> I removed line 184 from my table but still getting same Error!<br>
><br>
> Afterward, I tried calculating the costs using pgr_kdijkstraCost, but<br>
> unfortunately most of the results are "-1" which means that there is no<br>
> connection!<br>
><br>
> Important note: my network is somehow accurate (done on CAD), but I<br>
> think this is a normal cleaning that every expert of you may take it for<br>
> granted<br>
><br>
> Please assist in resolving this issue (even by suggesting new<br>
> tool/function) because my time is becoming tight and this is my first<br>
> real/full application using pgRouting<br>
><br>
> Regards,<br>
><br>
> Eyad<br>
><br>
> *From:*AUS - Eyad [mailto:<a href="mailto:b00038807@aus.edu">b00038807@aus.edu</a>]<br>
> *Sent:* Monday, December 15, 2014 12:44 AM<br>
> *To:* 'pgRouting users mailing list'<br>
> *Subject:* Cleaning multilinestring vector network for routing via<br>
kDijkstra<br>
><br>
> Hi All,<br>
><br>
> I'm facing a serious issue preparing my multilinestring vector network<br>
> for routing.<br>
><br>
> I imported my vector network from CAD file. Obviously, there are some<br>
> areas where lines are intercrossing still not routable_through;<br>
> although, they are connected to each others!<br>
><br>
> I used V.Clean (advance) to clean the network before importing to the<br>
> database. I tried (break, snap, bpol, etc) alternatively but still not<br>
> sure which one is the proper tool. Also I'm finding it hard to set the<br>
> parameters because my vector network is obviously imported in<br>
> millimeters while the network is spread on a length reaching 700m from<br>
> start to destination from some ends.<br>
><br>
> I'm testing the results via shortest_path plugin before I import to<br>
> DataBase. In few successful cases using shortest_path, afterwards the<br>
> network gets to lose a lot of elements while importing to DB (i.e. 600<br>
> features only written from 700).<br>
><br>
> If there are other ways to make the network clean and routable, please<br>
> suggest<br>
><br>
> I'm using QGIS 2.4.0 and pgRouting pg93-binaries-2.4.0<br>
><br>
> Regards..<br>
><br>
> Eyad<br>
><br>
><br>
><br>
> _______________________________________________<br>
> Pgrouting-users mailing list<br>
> <a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
><br>
<br>
_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
</div></div>-----<br>
No virus found in this message.<br>
Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>
Version: 2015.0.5577 / Virus Database: 4235/8736 - Release Date: 12/14/14<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
</div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG & Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66,99,171)" target="_blank">daniel.kastl@georepublic.de</a><br>Web: <a href="http://georepublic.info" style="color:rgb(66,99,171)" target="_blank">http://georepublic.info</a></span><div><br></div><div><br></div><div><br></div></div></div>
</div>