gpt4 book ai didi

android - 点击 Android 谷歌地图上的图标时获取完整的详细信息

转载 作者:太空狗 更新时间:2023-10-29 15:01:39 25 4
gpt4 key购买 nike

当我点击 Google map 上的图标时,我想要研究所、公司、企业名称及其地址。

例子:-在谷歌地图应用程序上,当点击图标时,它将显示该图标的完整详细信息和地址。

找到三张图片。当我点击“HealthCare Global Enterprise Ltd.”时。图标,然后它会在屏幕顶部给出完整的地址和医院名称。

我正在使用 Geocoder 获取特定经纬度的地址。我正在获取街道、国家/地区、密码等信息,但无法获取学院、公司、企业名称。

此处医院名称:HealthCare Global Enterprise Ltd.

代码:-

private String getCompleteAddressString(double LATITUDE, double LONGITUDE) {
String strAdd = "";
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
StringBuilder strReturnedAddress = null;
try {
List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
if (addresses != null) {
System.out.println("Address Size ->>: " + addresses.size());
System.out.println("Address 0th Position ->>: " + addresses.get(0));
Address returnedAddress = addresses.get(0);
strReturnedAddress = new StringBuilder("");

for (int i = 0; i < returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");

System.out.println("*****************************");
System.out.println("Admin Area: ->> " + returnedAddress.getAdminArea());
System.out.println("Country Code: ->> " + returnedAddress.getCountryCode());
System.out.println("Country Name: ->> " + returnedAddress.getCountryName());
System.out.println("Feature Name: ->> " + returnedAddress.getFeatureName());
System.out.println("Admin Area: ->> " + returnedAddress.getLatitude());
System.out.println("Latitude: ->> " + returnedAddress.getLocality());
System.out.println("Longitude: ->> " + returnedAddress.getLongitude());
System.out.println("Max Address Line Index: ->> " + returnedAddress.getMaxAddressLineIndex());
System.out.println("Phone: ->> " + returnedAddress.getPhone());
System.out.println("PostalCode: ->> " + returnedAddress.getPostalCode());
System.out.println("Premises: ->> " + returnedAddress.getPremises());
System.out.println("SubAdminArea: ->> " + returnedAddress.getSubAdminArea());
System.out.println("SubLocality: ->> " + returnedAddress.getSubLocality());
System.out.println("SubThoroughfare: ->> " + returnedAddress.getSubThoroughfare());
System.out.println("Thoroughfare: ->> " + returnedAddress.getThoroughfare());
System.out.println("Url: ->> " + returnedAddress.getUrl());
System.out.println("*****************************");
}
strAdd = strReturnedAddress.toString();
Log.w("My Current loction address", "" + strReturnedAddress.toString());
} else {
Log.w("My Current loction address", "No Address returned!");
}
} catch (Exception e) {
strReturnedAddress.append("Address Not Avilable");
strAdd = strReturnedAddress.toString();
}
return strAdd;
}

enter image description here enter image description here enter image description here

最佳答案

take a look at Google API picker这有助于确定使用哪个 Google API 来获取您正在寻找的数据类型。根据您的问题,您似乎需要地点的公司或公司名称,以及其他详细信息。可通过 Google Place API 获得, 下面是它的摘要。

“获取地点的名称、地址、营业时间和其他详细信息,包括客户评分和评论。”

它是 REST 类型的 API,您可以提供位置坐标,并以 JSON 形式返回详细信息。请看这个SO question and answer for a sample code snippet .

关于android - 点击 Android 谷歌地图上的图标时获取完整的详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25971623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com