我正在开发一个Metro路由器应用程序,我想让用户只需按一下按钮即可获得最近的地铁站。我有一个Metro Stops(班加罗尔)的列表就是这个。
{
"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"
}
现在,当我使用位置管理器获取当前用户位置时,这将是详细版本,如“Surya City,Chandapura,Bommasandra,Bangalore”。现在我想知道如何从位置经理那里获得“Bommasandra”,因为这是Metro的停止。
如何从位置管理器获取结果后从数据库中获取最近的地铁站点。请帮忙。提前完成。
答案 0 :(得分:0)
我建议,首先,您需要按照接近Metro Stops的顺序排列所有Metro Stops列表,然后按List<String> AllRoute
排列,现在您必须解析包含特定Metro Stop的字符串从位置管理器类,您还可以将整个字符串与AllRoute列表项进行比较。从所有Metro Stops(AllRoute)列表中比较Metro Stop,并显示列表中用户的下3-4个站点,因为列表已按接近Metro Stop排序。
答案 1 :(得分:0)
我认为,在您的位置数组中,您可以将(lat,lng)与每个位置相关联。然后使用当前位置(lat,lng),您可以找到最近的位置