如何使用place_id而不是经度和纬度坐标创建位置标记?
public void onMapReady(GoogleMap map) {
LatLng sydney = new LatLng(-34, 151);
//I want to use the place_id to place in of the Latitude and Longitude
map.addMarker(new MarkerOptions().position(sydney).title(" Sydney"));
map.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
我认为地图API不支持这个。
相反,您需要实现对给定PlaceID的反向查找,以返回Lat Long并将其传递给addMarker函数。
如果您首先使用的是Places API来获取Place ID,那么查询Place Details将提供更丰富的位置信息- https://developers.google.com/places/web-service/details