1

I am developing a Metro Router app in which I want to give user the facility to get his nearest metro station just by pressing a button. I have a list of Metro Stops (for Bangalore) which is this.

{

"Bangalore International Exhibition Center", "Jindal", "Manjunathnagar", "Nagasandra",
 "Dasarahalli", "Jalahalli", "Peenya Industry", "Peenya", "Yeswanthpur Industry", 
 "Yeswanthpur", "Sandal Soap Factory", "Mahalaxmi", "Rajajinagar", "Kuvempu Road", 
 "Srirampura", "Sampige Road", "Kempegowda Interchange", "Chikpet", "K R Market", 
 "National College", "Lalbagh", "South End Circle", "Jayanagar", "R V Road 
 Interchange", "Banashankari", "J P Nagar", "Puttenahalli", "Anjanapura Cross Road", 
 "Krishna Leela Park", "Vajrahalli", "Thaighattapura", "Anjanapura/NICE Junction", 
 "Kengeri", "R V College of Engineering", "Bangalore University Cross", "Rajarajeshwari 
 Nagar", "Nayandahalli", "Mysore Road", "Deepanjali Nagar", "Attiguppe", "Vijayanagar", 
 "Hosahall1i", "Magadi Road", "Sir M Vishweshwariah", "Vidhana Soudha", "M G Road 
 Interchange", "Trinity", "Halasuru", "Indiranagar", "S V Road", "Baiyyappanahalli", 
 "Jyotipura", "K R Puram", "Mahadevpura", "Garudacharpalya", "Doddanekkundi Induatrial 
 State", "Vishweshwariah Industrial State", "Kundanahalli", "Vydhehi Hospital", "Satya 
 Sai Medical Institute", "ITPB", "Kadugodi  Industrial Area", "Ujjwal Vidhyalaya", 
 "Whitefield", "Nagawara", "Arabic College", "Venkateshpura", "Tannery Town", "Pottery 
 Town", "Cantonment Railway Station", "Shivajinagar", "Vellara Junction", "Langford 
 Town", "Mico Bosch", "Dairy Circle", "Swagath Road Cross", "Jayadeva Hospital 
 Interchange", "J P Nagar 4th Phase", "IIMB", "Hulimavu", "Gottigere", "Ragigudda 
 Temple", "BTM Layout", "Silk Board", "HSR Layout", "Oxford College", "Muneshwara 
 Nagar", "Chikkabegur", "Basapura Road", "Hosa Road", "Electronics City 1", 
 "Electronics City 2", "Huskur Road", "Hebbagodi", "Bommasandra"

}

Now, when I get the Current User location by using location Manager, that would be in detailed version, like "Surya City, Chandapura, Bommasandra, Bangalore". Now I want to know that how to get the "Bommasandra" specifically from location manager, as this is the stop of Metro.

And how to fetch nearest metro stop from the database after getting the result from location manager. Help please. Thanx in advance.

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
Aishvarya Jaiswal
  • 1,793
  • 6
  • 34
  • 72
  • 1
    Check if this helps http://stackoverflow.com/questions/4057665/google-maps-api-v3-find-nearest-markers – Herojit Oct 01 '13 at 05:03
  • Wow.. That was quite helpful, but how to add my Markers on my map.? As you can see I have some specific places where I want my Markers. Please help. – Aishvarya Jaiswal Oct 01 '13 at 05:06

2 Answers2

0

I suggest , First of all you need to arrange your list of all Metro Stops into ascending order in terms of Approaching Metro Stops say you arrange them in List<String> AllRoute, Now you have to parse a string containing specific Metro Stop from Location Manager class you can also compare the whole string with items of AllRoute list. Compare the Metro Stop from list of all Metro Stops (AllRoute) and display the next 3-4 stops from the List to user as list is already sorted in terms of approaching Metro Stop.

Jitender Dev
  • 6,907
  • 2
  • 24
  • 35
0

I think, in your location array, you can associate a (lat, lng) with each location. Then using the current location (lat, lng), you can find the nearest location

Herojit
  • 32
  • 3