在flutter中获取地点ID的地址
Get an address for place ID in flutter
我是 Flutter 的新手
我正在处理一个使用地点 API 和 Google 地图的项目。
我希望用户在输入地点 ID 时能够获得地点地址。
我已经能够使用地理编码检索地点 ID。
请问如何使用地点 ID 获取地点地址
final geocoding = GoogleMapsGeocoding(
apiKey: '...........');
final response = await geocoding.searchByPlaceId('ChIJd8BlQ2BZwokRAFUEcm_qrcA');
final result = response.results[0].formattedAddress;
// Result will be: 277 Bedford Ave, Brooklyn, NY 11211, USA
记得从开发者控制台启用该服务。
您可以从官方文档中阅读有关地点 ID 的所有信息:
https://developers.google.com/maps/documentation/places/web-service/place-id
只需发出 GET 请求:
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJrTLr-GyuEmsRBfy61i59si0&key=YOUR_API_KEY
我是 Flutter 的新手
我正在处理一个使用地点 API 和 Google 地图的项目。 我希望用户在输入地点 ID 时能够获得地点地址。
我已经能够使用地理编码检索地点 ID。
请问如何使用地点 ID 获取地点地址
final geocoding = GoogleMapsGeocoding(
apiKey: '...........');
final response = await geocoding.searchByPlaceId('ChIJd8BlQ2BZwokRAFUEcm_qrcA');
final result = response.results[0].formattedAddress;
// Result will be: 277 Bedford Ave, Brooklyn, NY 11211, USA
记得从开发者控制台启用该服务。
您可以从官方文档中阅读有关地点 ID 的所有信息: https://developers.google.com/maps/documentation/places/web-service/place-id
只需发出 GET 请求:
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJrTLr-GyuEmsRBfy61i59si0&key=YOUR_API_KEY