2010-11-04 69 views
3

好吧,所以我一直在寻找相当一段时间。从纬度/经度在Android中获取商业名称或地标

我从我的新找到的位置有一个lat/long。 geocoder的getFromLocation返回经纬度的一定数量的地址,这一切都很好。然后,我把它放入一个适配器,填充一个微调器......也是完美的。

我现在需要的是获取企业名称而不是地址。我更愿意使用lat long,并在一定距离内获得所有业务,因为不是从getFromLocation返回的所有地址都完成了。有些只是社区或国家。

这个链接做得很好,尽管我还没有实现它。在我看来,像Google这样的大型假发应该是非常标准的处理能力似乎很多。

http://www.smnirven.com/?p=39

在此先感谢。

public void getFeature() { 
    double lat = currentLocation.getLatitude(); 
    double lon = currentLocation.getLongitude(); 
    Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault()); 

    try { 
     List<Address> tmpfeatures = gc.getFromLocation(lat, lon, 15); 
     Iterator itr = tmpfeatures.iterator(); 
     while (itr.hasNext()) { 
      featuresAdapter.add(((Address) itr.next()).getFeatureName().toString()); 
     } 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } 
} 

回答