Getting error in php (xml:parser well-not formed)

Okay, please do the following

Find this code

$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,
length(rt.the_geom) AS length, ".TABLE.".id
FROM ".TABLE.",
(SELECT gid, the_geom
FROM dijkstra_sp_delta(
'".TABLE."',
".$startEdge['source'].",
".$endEdge['target'].",
3000)
) as rt
WHERE ".TABLE.".gid=rt.gid;";

And change it to

$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,
length(rt.the_geom) AS length, ".TABLE.".id
FROM ".TABLE.",
(SELECT gid, the_geom
FROM dijkstra_sp_delta(
'".TABLE."',
".$startEdge['source'].",
".$endEdge['target'].",
3000)
) as rt
WHERE ".TABLE.".gid=rt.gid;";

echo '<br /><br />Query Executed:<br />' . $sql . '<br /><br />';

Then copy that SQL query and run it your Database Admin (some use phpPgAdmin, not sure what you might be using).

Paste the query and the results here. I suspect it is only returning 1 record for the start and end points of -6.466140625, 1.13427734375 and 21.5389765625, 18.993828125 respectively.

Hi cpradio,

The query you given is returning

" edge=43</br>source=37</br>target=32</br>the_geom=0105000000010000000102000000060000004C60BAF79BFE26C0AB758262C883B0BF94154C4DC8F324C032899FD65E16CD3FC145A98EFDEF21C0471698AEA01ADE3FD0E9F797CF741DC0253C44196163E83F4A50F132FC9718C094369EEDB8DCF03FD4390ADA895014C0574EDC4003280240</br>edge=28</br>source=22</br>target=25</br>the_geom=0105000000010000000102000000030000000000000000002F400000000000002F400000000000003340000000000000334000000000008037400000000000003340</br>startedge=37</br>endedge=25</br><br /><br />Query Executed:<br />SELECT rt.gid, AsText(rt.the_geom) AS wkt,"

I used this query in database it will give me the output in the database:

SELECT rt.gid, AsText(rt.the_geom) AS wkt,
length(rt.the_geom) AS length, “roads”.id
FROM “roads”,
(SELECT gid, the_geom
FROM “roads”) as rt
WHERE “roads”.gid=rt.gid;

attached screen shot for reference. Should i use this query for my apps… ??

The above query definitely doesn’t match what is shown in your code

$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,
length(rt.the_geom) AS length, ".TABLE.".id
FROM ".TABLE.",
(SELECT gid, the_geom
FROM dijkstra_sp_delta( // uses stored procedure
'".TABLE."', // passes in roads
".$startEdge['source'].", // passes in 37
".$endEdge['target'].", // passes in 25
3000)
) as rt
WHERE ".TABLE.".gid=rt.gid;";

So if you run

SELECT rt.gid, AsText(rt.the_geom) AS wkt,
length(rt.the_geom) AS length, "roads".id
FROM "roads",
(SELECT gid, the_geom
FROM dijkstra_sp_delta("roads", 37, 25, 3000)) as rt
WHERE "roads".gid=rt.gid;

What output do you get?

I can’t really answer that, as I don’t know what your app is attempting to do. The way you wrote your query, you are getting ALL results and not just related results to the start/end locations that are defined.

SQL error:

ERROR: function dijkstra_sp_delta(roads, integer, integer, integer) does not exist
LINE 13: FROM dijkstra_sp_delta(“roads”, 37, 25, 3000)) as rt
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.