【发布时间】:2011-05-05 09:02:13
【问题描述】:
好的,所以我一直在寻找相当长的时间。
我的新位置有一个纬度/经度。地理编码器的 getFromLocation 从纬度/经度返回一定数量的地址,这一切都很好。然后我把它放入一个填充微调器的适配器中......也很完美。
我现在需要的是获取公司名称而不是地址。我更喜欢使用 lat long 并在一定距离内获取所有业务,因为并非从 getFromLocation 返回的所有地址都是完整的。有些只是社区或国家。
这个链接做得很好,虽然我还没有实现它。在我看来,对于像谷歌这样的大人物来说,这似乎是相当标准的处理能力。
提前致谢。
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();
}
}
【问题讨论】:
标签: android google-maps-api-3 geocoding