我发送的请求是这样的:
但是回应如下:
{
"html_attributions" : [],
"results" : [],
"status" : "INVALID_REQUEST"
}
我的请求有什么问题导致它无效?
答案 0 :(得分:1)
来自文档:
radius - 定义返回地点结果的距离(以米为单位)。允许的最大半径为50 000米。请注意,如果指定了rankby = distance(在下面的可选参数下描述),则不得包括半径。
从请求中移除rankby=distance
(对于30米半径,它没有意义)。
https://maps.googleapis.com/maps/api/place/search/json?radius=30&location=37.7858742105946,-122.406341359019&key=<KEY>&type=establishment
给我这个答复:
{
"html_attributions" : [],
"results" : [
{
"geometry" : {
"location" : {
"lat" : 37.7860877,
"lng" : -122.4064646
},
"viewport" : {
"northeast" : {
"lat" : 37.7874464802915,
"lng" : -122.4050379197085
},
"southwest" : {
"lat" : 37.7847485197085,
"lng" : -122.4077358802915
}
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
"id" : "acf15a7460a5b2a3c8f7bba1af978fb2fc744f0d",
"name" : "A/X Armani Exchange",
"opening_hours" : {
"open_now" : false,
"weekday_text" : []
},
"place_id" : "ChIJZyuhr4iAhYARpQEX4hwEJQI",
"rating" : 4.1,
"reference" : "CmRRAAAAMfTprFXJRaU_yLIqTAeIcGTxQ_6S2eYtBeRTwKk_7Pl6yXePzu3fNbz1gsEyTGEE_l8k_iW7VPjjpL34ynxSdzti1ivWeFQds_m9UD7cEqTuIldgqnT-46iySaeTEdMtEhBCcM7tqTnT5B_4a7gnK81cGhRJKFvJGTM33KhWHKUlrZ6xN7TuEQ",
"scope" : "GOOGLE",
"types" : [ "clothing_store", "store", "point_of_interest", "establishment" ],
"vicinity" : "25 Stockton Street, San Francisco"
}
],
"status" : "OK"
}