# from coordinates can i find from multilinestring from database

Hello i have the coordinates from two points(x,y) and i have a database with roads and i want to find with dijstrak algorithm wich road i take but the algorithm want source and target but in my application i take only (x,y) coordinates

``````SELECT seq, id1 AS node, id2 AS edge, cost
FROM pgr_dijkstra(
'SELECT id, source, target, cost FROM edge_table',
7, 12, false, false
);
``````

Can sameone help me ?

UPDATE I try this but i take all gid from table roads and not the gid it is close of the point

``````SELECT gid, ST_Distance(ST_Transform(ST_GeomFromText('POINT(39.240443 26.208803)',3857),4326),geom) AS myLineDistance
WHERE geom && ST_expand(ST_Transform(ST_GeomFromText('POINT(39.240443 26.208803)',3857),4326), 100);
``````

There are a few possibilities how to achieve this:

## Start/end with nearest nodes

The easiest way is to start from the nearest node from the start point and end with the nearest node from the end point, as explained in the pgRouting workshop.

But sometimes the nearest nodes can be far from your x/y coordinates, so you could do better with ...

## Start/end from nearest edge

In this case you look for the nearest road segments to your coordinates and with PostGIS function `ST_Line_Interpolate_Point` and function `ST_Line_Substring` you could split the road segment at the nearest point and create "temporary" nodes for start and end point.

But this is more complicated.

## TRSP function

The third option would be to use TRSP function, because it allows to specify the edge ID as well as the position on that edge to start/end.