Edited:
I want to ilustrate my question. Suppose that you're in "Point A" and want to go to "Point B". This points wouldn't be in "at_2po_4pgr" table cause aren't source/targets nodes. Then, I would search for the nearest node for points A and B (green points). After this, I might perform a shortest_path call using green points ids and I would obtain "orange" path. But to obtain the real path cost (distance) in first case I would have to substract "offsetA" and in second case add de "offset B". To calculate distance between red-points and green-points, I run the following query:
SELECT * FROM st_distance(ST_GeomFromText('POINT(-3.6963314 42.3498066)',4326),ST_GeomFromText('POINT(-3.6954276 42.3479634)',4326)).
How I would know when add or substract the offset?
Sorry for my english!
أكثر...

I want to ilustrate my question. Suppose that you're in "Point A" and want to go to "Point B". This points wouldn't be in "at_2po_4pgr" table cause aren't source/targets nodes. Then, I would search for the nearest node for points A and B (green points). After this, I might perform a shortest_path call using green points ids and I would obtain "orange" path. But to obtain the real path cost (distance) in first case I would have to substract "offsetA" and in second case add de "offset B". To calculate distance between red-points and green-points, I run the following query:
SELECT * FROM st_distance(ST_GeomFromText('POINT(-3.6963314 42.3498066)',4326),ST_GeomFromText('POINT(-3.6954276 42.3479634)',4326)).
How I would know when add or substract the offset?
Sorry for my english!
أكثر...