如何在谷歌地图上设置特定类型的位置?

问题描述 投票:0回答:2

我想获取特定类型的附近位置,但谷歌地图上不存在该类型。我想添加该类型。我们是否可以在谷歌地图上添加类型。

javascript google-maps google-maps-api-3
2个回答
0
投票

谷歌地图上不存在类型。

您可以添加此代码:

var service = new google.maps.places.PlacesService(map);
                service.nearbySearch({
                    location: theLocation.value,
                    radius: radius,
                    type: ['restaurant'], 
                    openNow: true,
                    minPriceLevel: minprice

                }, yourCallback);

并使用

type
参数指定您要查找的位置类型(这里我们找到一些餐馆)。

您可以查阅文档类型参数在附近搜索的描述中指定。

如果您有任何疑问请告诉我。


0
投票
var service = new google.maps.places.PlacesService(map);
                service.nearbySearch({
                    location: theLocation.value,
                    radius: radius,
                    type: ['restaurant'], 
                    openNow: true,
                    minPriceLevel: minprice

                }, yourCallback);
© www.soinside.com 2019 - 2024. All rights reserved.