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.

4

2 回答 2

0

我建议,首先你需要按照接近地铁站的方式将所有地铁站的列表按升序排列,说你安排它们List<String> AllRoute,现在你必须从位置管理器类中解析一个包含特定地铁站的字符串,你也可以比较带有 AllRoute 列表项的整个字符串。比较所有地铁站 (AllRoute) 列表中的地铁站,并将列表中接下来的 3-4 站显示给用户,因为列表已经按照接近地铁站的方式进行了排序。

于 2013-10-01T05:08:30.227 回答
0

我认为,在您的位置数组中,您可以将 (lat, lng) 与每个位置相关联。然后使用当前位置(lat,lng),可以找到最近的位置

于 2013-10-01T05:10:28.520 回答