# [pgrouting-users] pgr_withPoints not working correctly

Josep Lopez Xarbau jlopez at tecnocampus.cat
Thu Apr 14 11:03:19 PDT 2016

```Hi, I've tried this function and it seems not to work correctly. When it calculates the route between vertex it does well, but when using the pointsofinterest, it confuses the ids of the points and the result is incorrect.
If we take a look at the example:

Example:

>From point 1 to point 3

SELECT * FROM pgr_withPoints(
'SELECT id, source, target, cost, reverse_cost FROM edge_table ORDER BY id',
'SELECT pid, edge_id, fraction, side from pointsOfInterest',
-1, -3);
seq | path_seq | node | edge | cost | agg_cost
-----+----------+------+------+------+----------
1 |        1 |   -1 |    1 |  0.6 |        0
2 |        2 |    2 |    4 |    1 |      0.6
3 |        3 |    5 |    7 |    1 |      1.6
4 |        4 |    8 |    6 |  0.7 |      2.6
5 |        5 |   -3 |   -1 |    0 |      3.3
(5 rows)
If we follow the edges, we'll see that it begins from the point 1 but ends at point 4. Edges sequence(1,4,7,6)
[../../../_images/Fig1-originalData.png]

These are the correspondences of the points

Point of 'Pointsofinterest'          Point used by pgr_withpoints

1                                                                                                                  1

2                                                                                                                  5

3                                                                                                                  4

4                                                                                                                  2

5                                                                                                                  3

6                                                                                                                  6
Hope I explained myself clearly, and sorry for my English (;P).

Josep.
________________________________
CONFIDENCIALITAT
Aquesta informaci? ?s confidencial, personal i intransferible i nom?s va dirigida a la/les adre?a/ces indicades. Qualsevol modificaci?, retransmissi?, difusi? o altre ?s d'aquesta informaci? per persones o entitats diferents a la persona a qui va dirigida est? prohibida. Si vost? l'ha rebut per error, li preguem que ho reenvi? a desconegut at tecnocampus.cat<mailto:desconegut at tecnocampus.com>, i esborri el missatge original juntament amb els seus fitxers annexos sense llegir-lo ni gravar-lo. Gr?cies.
Abans d'imprimir-lo, assegura't de que ?s realment necessari.
EL MEDI AMBIENT ?S COSA DE TOTS.

La presente informaci?n es confidencial, personal e intransferible y s?lo va dirigida a la/s direcci?n/es indicadas. Cualquier modificaci?n, retransmisi?n, difusi?n u otro uso de esta informaci?n por personas o entidades diferentes a la persona a la que va dirigida est? prohibida. Si usted lo ha recibido por error, le rogamos que lo reenvie a desconegut at tecnocampus.com, y borre el mensaje original junto con sus ficheros anexos sin leerlo ni grabarlo. Gracias.
Antes de imprimir, aseg?rese que es realmente necesario hacerlo.
EL MEDIO AMBIENTE ES COSA DE TODOS.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20160414/cb13968c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 88031 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20160414/cb13968c/attachment-0001.png>
```