Began to deal with the Google Maps API . Interested in the placement of markers in a radius of n-km from the place of stay.

How to implement? Maybe give links to resources, examples?

Example:

There are 100 markers, but so that only those within a radius of, for example, 10-km are displayed on the map.

    1 answer 1

    What is the actual problem?

    Calculate current location

      private GoogleMap.OnMyLocationChangeListener myLocationChangeListener = new GoogleMap.OnMyLocationChangeListener() { @Override public void onMyLocationChange(Location l) { for(Marker marker:AllMarkers){ if(CalculationDistance(marker.getPosition(),new LatLng(l.getLatitude(),l.getLongitude())) <10000) { //рисуем marker маркер на карте } } } }; mMap.setOnMyLocationChangeListener(myLocationChangeListener); public static double CalculationDistance(LatLng StartP, LatLng EndP) { return CalculationDistanceByCoord(StartP.latitude, StartP.longitude, EndP.latitude, EndP.longitude); } private static double CalculationDistanceByCoord(double startPointLat,double startPointLon,double endPointLat,double endPointLon){ float[] results = new float[1]; Location.distanceBetween(startPointLat, startPointLon, endPointLat, endPointLon, results); return results[0]; } 

    Where AllMarkers is your collection with markers