获得企业名称或者标志性建筑从Android的纬度/经度 [英] Getting business names or landmarks from lat/long in Android
问题描述
好了,我一直在寻找在这相当长的一段时间。
我有一个经/纬度从我的新发现的位置。地理codeR的getFromLocation从纬度/长返回一定数量的地址,这是所有罚款和花花公子。然后,我把它放到它填充一个微调适配器...也可以完美运行。
我现在需要的是什么,虽然是让企业的名称,而不是地址。我想preFER使用纬度长,并得到所有的企业在一定距离内,因为不是所有的getFromLocation返回的地址是完整的。有些人只是社区或国家。
此环节做得很好,虽然我还没有实现它。在我看来,这似乎是一个很大的处理能力,什么应该从一个像谷歌大假发pretty标准。
先谢谢了。
公共无效getFeature(){
双纬度= currentLocation.getLatitude();
双LON = currentLocation.getLongitude();
地理codeR GC =新的地缘codeR(getBaseContext(),Locale.getDefault()); 尝试{
清单<地址> tmpfeatures = gc.getFromLocation(纬度,经度,15);
迭代器ITR = tmpfeatures.iterator();
而(itr.hasNext()){
featuresAdapter.add(((地址)itr.next())getFeatureName()的toString());
}
}赶上(IOException异常五){
e.printStackTrace();
}
}
谷歌Places API的。注册开发人员preVIEW。
HTTP://$c$c.google.com/apis /地图/文档/地/
Ok, so I have been searching for quite some time on this.
I have a lat/long from my new found location. geocoder's getFromLocation returns a certain number of addresses from the lat/long and that is all fine and dandy. I then put it into an adapter which populates a spinner... also works perfect.
What I need now though is to get business names instead of addresses. I would prefer to use the lat long and get all businesses within a certain distance because not all the addresses returned from getFromLocation are complete. Some are just neighborhoods or countries.
This link does a good job although I have not implemented it yet. In my mind, it seems like a lot of processing power for what should be pretty standard from a big-wig like Google.
Thanks in advance.
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();
}
}
Google Places API. Sign up for the developer preview.
http://code.google.com/apis/maps/documentation/places/
这篇关于获得企业名称或者标志性建筑从Android的纬度/经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!