2016-08-13 2 views
1

마커를 사용하여 일부 위치 데이터를 표시하기 위해 GoogleMap 조각을 사용하고 있습니다. 내가하고 싶은 일은지도에 특정 거리의 반경을 가진 원을 그리면 원이 대략지도상의 특정 영역을 덮을 것입니다. 어디서부터 시작해야할지 모르겠다. 이미 위치 데이터를 표시하는지도를 가지고 있는데, 위치 데이터를 통해 중심점과 거리가 먼 지점을 파악할 수있다.지도에서 특정 거리를 다루는 원을 그리는 방법

도움이 될 것입니다.

답변

1

GoogleMap Circle API을 사용하십시오. 필수 입력을 전달하면 완료됩니다. 예제에서 링크를 따르십시오. 문서에서 간단한 코드 구조 상세 정보 확인을 위해이

Circle circle = map.addCircle(new CircleOptions() 
    .center(new LatLng(-33.87365, 151.20689)) // center point of map 
    .radius(10000) // radius of circle to cover on map 
    .strokeColor(Color.RED) //color of circle boundary 
    .fillColor(Color.BLUE)); //color of circle to fill , 
           // make sure choose the light color close to transparent 
1

를 사용하여 당신은 당신이 그것을 호출 할 때 paramaterLatLng을 통과해야이 기능을.

private void drawCircle(LatLng point){ 

    CircleOptions circleOptions = new CircleOptions(); 

    // Specifying the center of the circle 
    circleOptions.center(point); 

    // Radius of the circle 
    circleOptions.radius(20); 

    // Border color of the circle 
    circleOptions.strokeColor(Color.BLACK); 

    // Fill color of the circle 
    circleOptions.fillColor(0x30ff0000); 

    // Border width of the circle 
    circleOptions.strokeWidth(2); 

    // Adding the circle to the GoogleMap 
    googleMap.addCircle(circleOptions); 

} 
관련 문제