[英]Draw four circle on the google map by taking current location as the center of circle
[英]Drawing Circle on Map around current location and showing only markers from that circle rather than outside circle in android
我能够在当前位置周围的地图上绘制圆圈,但我只想在该圆圈内显示标记,并从地图中隐藏其他标记。
您需要先绘制一个圆 ,然后使用此方法比较每个标记在圆的内部还是外部。
private void checkCircle(){
float[] distance = new float[2];
Location.distanceBetween(marker_latitude, marker_longitude,
circle.getCenter().latitude, circle.getCenter().longitude, distance);
if(distance[0] > circle.getRadius() ){
Toast.makeText(getContext(), "Outside", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getContext(), "Inside", Toast.LENGTH_LONG).show();
}
}
如果您得到的标记不在外面,则不需要添加地图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.