我计划构建一个android应用程序,在地图上的某个点周围画一个圆圈,并在这个圆圈内找到所有感兴趣的点(例如酒店)。
我通过使用创建了应用程序中的循环
GoogleMap map;
Circle circle = map.addCircle(new CircleOptions()
.center(new LatLng(MY_LAT, MY_LONG))
.radius(MY_RADIUS)
.strokeColor(Color.RED)
.fillColor(Color.BLUE));我还知道我可以使用找到感兴趣的地方。
据我所知,PlacePicker用于搜索感兴趣的地方。
经过进一步的研究,我意识到我实际上可以使用LatLng和setLatLngBounds()方法为PlacePicker设置LatLngBounds界限。该方法接受东北角和西南角,但如何确定它们?
我的问题是--如何让PlacePicker扫描给定圆圈内所有感兴趣的地方?
我想到的一个可能的解决办法是:
1)利用这种方法获取一组NE点和SW点。
2)将这些作为参数添加到setLatLngBounds()方法中
3)使用PlacePicker
这样做合适吗?或者有没有更短的解决办法?
发布于 2016-02-09 06:41:36
你可能得用
StringBuilder googlePlacesUrl = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
googlePlacesUrl.append("location=" + latLng.latitude + "," + latLng.longitude);
googlePlacesUrl.append("&radius=" + 3);
googlePlacesUrl.append("&types=" + type);
googlePlacesUrl.append("&sensor=true");
googlePlacesUrl.append("&key=" + "server key from google console");只需使用类型作为酒店,etcs和radius可能取决于您的需要。
https://stackoverflow.com/questions/35285358
复制相似问题