I have few points from server and I want to draw a line with this point on road. But the leaflet drawing point to point line as shown in picture in orange color. But I want to draw the line according to the blue line. How it can be done?
pgRouting could be a solution (Official website), are you tried it as PostgreSQL extension?, it could do the trick... But, you needs a good vectorial layer "road".
It's only a idea... :)
If you know all of your roads are pure N/S and E/W you could use the two points on either side of the intersection to come up with the intermediate point. In other words, if the last point before the turn is X1,Y1 and the point after the turn is X2,Y2, you could insert a point X1,Y2 which would be the intersection. Of course, this only works if you have all right angles in your routes and they are all completely N/S or E/W. Another option which could work or straight lines without requiring N/S and E/W routes would be to find a line for each route and then find the intersection. You would need a second point on the route after the turn though. Otherwise, you simply do not have the data for the point.