将半径比转换为km或米。
如果我把radius = 500怎么办?半径500到公里或米的等效性是多少?
1个半径到公里是多少?
StringBuilder googlePlacesUrl = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
googlePlacesUrl.append("location=" + latitude + "," + longitude);
googlePlacesUrl.append("&radius=10000");
googlePlacesUrl.append("&type=" + "art_gallery");
googlePlacesUrl.append("&sensor=true");
googlePlacesUrl.append("&key=" + "AIzaSyCx8-ZK6m5FTgEoTaSRaUuALV-5Vnz1Co4");
Log.d("getUrl", googlePlacesUrl.toString());
return (googlePlacesUrl.toString());
答案 0 :(得分:0)
半径参数以米为单位。所以你应该用米转换,然后在下面的url中传递它。
StringBuilder googlePlacesUrl = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
googlePlacesUrl.append("location=" + latitude + "," + longitude);
googlePlacesUrl.append("&radius=10000");
googlePlacesUrl.append("&type=" + "art_gallery");
googlePlacesUrl.append("&sensor=true");
googlePlacesUrl.append("&key=" + "AIzaSyCx8-ZK6m5FTgEoTaSRaUuALV-5Vnz1Co4");
Log.d("getUrl", googlePlacesUrl.toString());
return (googlePlacesUrl.toString());