I'm trying to draw grids on map only when zoom level is 18. I created grids with below code successfully. But i have one problem when I move map, new grids are created and there position change. You can see that in screenshot in right image I swiped map to left and grid lines are not same. I want fixed grids drawn. Code posted below images.
I'm calling below code from onCameraChange listener of GoogleMap.
double squareSize = 5.0d; //5.0d == 50feet
final double LONGITUDE_180 = 180.0d;
final double LATITUDE_90 = 90.0d;
final double PI = 3.141592653589793d;
Code removed its confidential.
drawPolyline function to draw single line
private void drawPolyline(LatLng latLng, LatLng latLng2) {
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.add(latLng, latLng2);
polylineOptions.color(Color.argb(50, 0, 0, 100));
polylineOptions.width(3.5f);
polylineOptions.visible(true);
polylineOptions.geodesic(true);
Polyline polyline = googleMap.addPolyline(polylineOptions);
this.polylines.add(polyline);
}