Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm doing routing on android using OpenStreetMap. The routing is working well. But the problem is that I do not know how to use the individual points of the user. I use osm2po to convert the OSM data to a routable graph. At the moment I'm finding the nearest routing point of the user individual selected point. But this is not a satisfying solution. Because it can happen that the user is selecting the middle of the street, but in the most cases the next routing point is at the end of the street. So it can happen that the end point is at the one side or on the other side.

What I tried?

First I tried to connect the routed start/end point with the selected individual point. But that provides sometimes routes where the user has to go back.

Second I tried to calculate the distance from the second last point to the last point and to the individual selected point. This works for some examples well, but not for all. So the problem is that the Geom_Way does not represent the line with points in a defined distance. So I thought it is like this start point o---x---x---x---o dest point. Where o are start/dest point and x middle points. But this is only available by curved lines. Straight lines have only o----------o a start and a destination point. Therefore the second last point in the routed point list can be far away and I can get the following construct: enter image description here I remove the coordinates as long as the distance from the last point is shorter to the destination point as to the second last point. But this can cause that all point will be removed. Otherwise if I do it only once, than I run in the cases that maybe to less points will be removed and therefore the result do not correspond to that what I want. So it is at moment a bit luck to get right result.

Is there any possibility to make a routing from an individual point to an individual point by using OSM? I don't want to use neither pgrouting nor storing of routes in the database. It is classically routing: User selects two points and the software is delivering the way from start node to the destination node.

EDIT: Maybe I calculate the distance wrong. I use UTMCoordinates and not Lat/Long. The distance will be calculated by using the Euclidean distance and I calculate the difference of lat/long from the first two coordinates.

share|improve this question
    
Do you have the requirement of implementing your own routing engine? If not, you might want to check out OpenTripPlanner, which already handles routing on OSM data - github.com/openplans/OpenTripPlanner/wiki. Open-source Android client is here - github.com/CUTR-at-USF/OpenTripPlanner-for-Android/wiki –  Sean Barbeau Aug 2 '13 at 13:13
    
I've have already my own routing engine. It is only about the described problem and I do not really know how to solve them. –  Irgendw Pointer Aug 6 '13 at 5:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.