Natanael
Natanael

Reputation: 2420

How to trace a route in a MapView giving a list of names of streets, avenues, etc?

I'm developing an Android app. This app must to draw a route in a MapView. But the only data that I have is a list of names of the streets that forms the route. Is there a way to make Google Maps API return a route with the street names?

Edit: The data will be preprocessed on desktop using normal Java. Not directly on Android.

Upvotes: 0

Views: 190

Answers (1)

Gabriel Diego
Gabriel Diego

Reputation: 1020

I'm working in something similar. In general words I'm following those steps:

  1. Download a osm map from OpenStreetMap (example). Beware that if the area selected is too big, OpenStreetMap may not export the selected data. It crashed for the entire city of São Paulo, so I had to select a smaller area.
  2. Look for the intersections of the streets. The osm file is pure xml and each street has many tags each with also many tags.
  3. Add each node ref in a list for each street in your list of streets and find the node that occurs in the list of two streets (which corresponds to a intersection).
  4. Look for the node ref in the file (a integer value) and you find also the GPS coordinates of the node.
  5. Plot the coordinates in Google Maps.

Upvotes: 1

Related Questions