I use google maps and my question, how I can restrict scroll area on google maps? I use this method for restrict a rect area
mapDataView.getGoogleMap().setLatLngBoundsForCameraTarget(UIUtils.getLatLngBoundsFromCircle(circle));
public static LatLngBounds getLatLngBoundsFromCircle(Circle circle){
if(circle != null){
return new LatLngBounds.Builder()
// external rectangle
// .include(SphericalUtil.computeOffset(circle.getCenter(), circle.getRadius() * Math.sqrt(2), 45))
// .include(SphericalUtil.computeOffset(circle.getCenter(), circle.getRadius() * Math.sqrt(2), 225))
//internal rectangle
.include(SphericalUtil.computeOffset(circle.getCenter(), circle.getRadius(), 45))
.include(SphericalUtil.computeOffset(circle.getCenter(), circle.getRadius(), 225))
.build();
}
return null;
}
But I can restrict only external or internal rectangle. Do you know, maybe google has some method for polygon restriction or something else. I've spent more than 3 days to find a solution. Thanks in advance. More info I create a custom marker and draw circle with radius, for example 100m, then I allow moving the marker in the circle