Google 地图查看的地点的属性

properties of a place viewed by Google Maps

我正在建立一个网站,帮助人们在网上找到餐馆..所以我希望每个餐馆都显示一个小 Google 地图 现在我还在建立我的数据库,在 table 餐厅我有 id,name,phone,网站,.... 我的问题是我是否必须添加其他属性来帮助我在 Google 地图上准确定位该地点,它们是什么?

请注意,这是我第一次使用 google 地图,我真的不知道我需要确切地知道什么才能在地图上表示一个地方。 谢谢

要在 google 地图中定位某个地点,我们需要纬度和经度。

例如。在 android 中,标记一个位置

static final LatLng PERTH = new LatLng(-31.90, 115.86);
Marker perth = mMap.addMarker(new MarkerOptions()
                          .position(PERTH));

这里-31.90和115.86分别是经纬度。 我认为所有平台的逻辑可能都是一样的

定位地点的方法有多种。首先,你可以通过纬度和经度来做到这一点。为此,您可以使用 Reverse geocoding which can translate the latitude & longitude into an address. You also have the option of using place_id, it is used to uniquely identify a place in Google Maps. See Places IDs。您也可以选择使用该地点的地址,但我不推荐这样做;因为可以有多个同名的地方。

至于该地点的可用属性,您可能需要查看Place Details of Places API。这将 return 详细信息,例如 latitudelongitudeplace_idinternational_phone_numberopening_hourspermanently_closedprice_level , reviews

希望这对您有所帮助。祝你好运!