我正在尝试实现 Google Places Autocomplete API,有时我能够获取位置列表,但有时我会收到“无法加载搜索结果”的消息。有人可以帮我解决这个问题。
我收到此错误:
E/Google Maps Android API: Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: [The key...]
Android Application (<cert_fingerprint>;<package_name>):
Run Code Online (Sandbox Code Playgroud)
这就是我所看到的,而不是地图正常工作:
在我的app/build.gradle,我有这个:
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-awareness:16.0.0'
implementation 'com.google.android.gms:play-services-cast:16.2.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
Run Code Online (Sandbox Code Playgroud)
play-services-location是我需要的谷歌地图,对吗?我正在查看https://developers.google.com/android/guides/setup上的列表,我认为这Google Location and Activity Recognition - com.google.android.gms:play-services-location:16.0.0就是 …
google-maps google-maps-api-3 google-play-services google-maps-android-api-2 google-maps-android-api-1
我正在尝试使用以下内容访问 Google 的地理编码 API:
我得到以下信息:
{"error_message":您必须使用 API 密钥来验证对 Google Maps Platform API 的每个请求。更多信息请参考http://g.co/dev/maps-no-account ", "results": [], "status": "REQUEST_DENIED"}
我传递的密钥与启用了地理编码和地点 API 的项目相关联,并且该项目也启用了计费。
curl google-maps google-api google-maps-api-3 google-geocoding-api
所以我开发了一个代码,我在其中读取包含一些位置的文件(更准确地说是 15 个),其中第一个是仓库,其他 14 个位置是公共汽车需要经过以收集患者的地方。为了做到这一点,我使用 Google Maps API 密钥来收集真实距离并将它们最终写入 .txt 文件中。
import pandas as pd
import googlemaps
from itertools import tee
import numpy as np
#Read CSV file into data frame named 'df'
#change seperator (sep e.g. ',') type if necessary
df = pd.read_csv("D:/Utilizadores/Documents/FEUP/2018-2019/1º Semestre/PDI/Relatório/locais2.txt", sep='\\t',
engine='python', skiprows=[0], names=["address", "latitude", "longitude"])
lat = np.expand_dims(np.array(df["latitude"]), 1)
lon = np.expand_dims(np.array(df["longitude"]), 1)
coordinates = np.concatenate((lat, lon), axis=1)
coordinates = list(coordinates)
coordinates = [list(coor) for coor in coordinates]
#Perform request to use the Google …Run Code Online (Sandbox Code Playgroud)