<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> Hello all!<br>
><br>
> I am creating drive time radii (or isochrones) by allowing the user to<br>
> click on a map surface and entering a number of minutes.<br>
><br>
> Using the driving_distance function in pgrouting I am able to get very<br>
> close to a good solution, but it is somewhat limited in that you can<br>
> only route from node to node (vertex to vertex). In order to improve the<br>
> accuracy, I thought I would try to insert a new node/vertex as close as<br>
> possible to the coordinates that my user clicked. That way my start node<br>
> would always be as accurate as it can be.<br>
><br>
> Has anyone done this? I'm not sure I understand the assign_vertex_id<br>
> function and how the graph is constructed well enough to come up with a<br>
> solution myself.<br>
><br>
> Any help or direction is appreciated!<br>
<br>
What you would want to do in this case is:<br>
<br>
1. take you position and find the nearest edge to that location (EID,<br>
ESOURCE, ETARGET, ECOST, EREVERSE_COST)<br>
2. compute the ratio of distance along that edge (RATIO)<br>
3. then add a create a temporary node at that location (NEWNODE)<br>
4. then add edges from the temp node to each of the end points to that<br>
edge, paying attention to oneway-ness of that edge and assigning costs<br>
as a ratio of the original cost.<br>
<br>
So select edges for your query might look like and you would pass<br>
NEWNODE as the starting node.<br>
<br>
select gid, source, target, cost, reverse_cost from roads<br>
union all<br>
select maxgid+1, ESOURCE, NEWNODE, ECOST*RATIO, EREVERSE_COST*(1-RATIO)<br>
union all<br>
select maxgid+2, NEWNODE, ETARGET, ECOST*(1-RATIO), EREVERSE_COST*RATIO<br>
<br>
-Steve<br>
<br></blockquote><div><br></div><div>I get lost on your 3rd step: "Create a temporary node"</div><div>How do you insert just a node? The "roads" table is made up of edges, so wouldn't I need to insert an edge?</div>
</div>