astar (#17) - PgRouting? using A-Star (#207) - Message List
Hello I am having some problem with pgrouting.
My geometry column has srid = 4326.
First I tried to get the nearest edge by calling this function
SELECT gid, source, target, the_geom, distance(the_geom, GeometryFromText?('POINT(" + Long + " " + Lat + ")',4326)) As distance FROM irouting WHERE the_geom && SETSRID(BOX3D(GeometryFromText?('" + polygon + "'))::BOX3D,4326) ORDER BY distance LIMIT 1;
And I passed
Long = 114.90625845458985 and Lat = 4.8664399002813763 as my source and Long = 114.92273794677735 and Lat = 4.8760529373907513 as my target.
And my polygon was created from
string polygon = "POLYGON((" + minX + " " + minY + ", " + minX + " " + maxY + ", " + maxX + " " + maxY + ", " + maxX + " " + minY + ", " + minX + " " + minY + "))"; where double minY = Long - 200; double minX = Lat - 200; double maxY = Long + 200; double maxX = Lat + 200;
The output for source was this gid = 4014 source = 10057 target = 10058 length = 0.00099061620750021573 the_geom = 0102000020E610000005000000664E97C5C4B95C400AA359D93E7413409A417C60C7B95C40703FE081017413404CA4349BC7B95C40A453573ECB731340B9C2BB5CC4B95C4093A8177C9A7313402B508BC1C3B95C40B66801DA56731340
And the output for Target was gid = 3672 source = 3745 target = 3746 length = 0.000017282466802851143 the_geom = 0102000020E610000007000000CCEF3499F1BA5C403B6D8D08C681134034BC5983F7BA5C40257497C459811340B64C86E3F9BA5C405F7F129F3B811340F38E537424BB5C407C26FBE76980134085EE92382BBB5C40D2393FC571801340B1A206D330BB5C409E08E23C9C801340319A95ED43BB5C4036B05582C5811340
When I called this function, to get the route SELECT rt.gid As gid, AsText?(rt.the_geom) As wkt, length(rt.the_geom) As length FROM irouting As tb,length(rt.the_geom) As length FROM irouting As tb, (SELECT gid, the_geom FROM astar_sp_delta('irouting', " + SourceEdge? + ", " + TargetEdge? + ", 0.001)) As rt WHERE tb.gid = rt.gid;
The result was null. Which means there is no matching start edge and end edge. How can i resolve this? Please any suggestion would be highly appreciated.
Since you're using A* (same for Dijkstra) you you need a Node ID as start and end point. Only Shooting* takes Edge ID's as start and end.
This is because A* and Dijkstra search the shortest path from node to node, but Shoooting* from edge to edge.
So just take the start or end point of your start/end edge and it should work.daniel01/07/09 15:46:40 (23 months ago)