Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radius < 1.3 not show hole #2

Open
oNguyenDucManh opened this issue Feb 9, 2018 · 1 comment
Open

Radius < 1.3 not show hole #2

oNguyenDucManh opened this issue Feb 9, 2018 · 1 comment

Comments

@oNguyenDucManh
Copy link

No description provided.

@ThinClient
Copy link

ThinClient commented Dec 27, 2020

Had same issue. Found out that if you increase the number of points in MapHelper#createHole, the issue goes away. I set it to 100:

        int points = 100; // number of corners of inscribed polygon

        double radiusLatitude = Math.toDegrees(radius / (float) EARTH_RADIUS);
        double radiusLongitude = radiusLatitude / Math.cos(Math.toRadians(center.latitude));

        List<LatLng> result = new ArrayList<>(points);

        double anglePerCircleRegion = 2 * Math.PI / points;

        for (int i = 0; i < points; i++) {
            double theta = i * anglePerCircleRegion;
            double latitude = center.latitude + (radiusLatitude * Math.sin(theta));
            double longitude = center.longitude + (radiusLongitude * Math.cos(theta));

            result.add(new LatLng(latitude, longitude));
        }

        return result;
    }```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants