apps-android-commons
apps-android-commons copied to clipboard
Nearby export: Pins not all around me
Ideally pins should form a square or circle around my position, rather than using my position as a corner:
@nicolas-raoul, What are your thoughts on circle around my location and Can you please suggest some radius (in kilometers) ?
Rectangle is probably easier to implement for now. How about 10 kilometers North/South/East/West? A few years ago I originally said 100 km but there are many more points now so it would take too long.
Thanks for providing information. I will work on it!
Hey @nicolas-raoul, I have added to code to give coordinates for 10Km North-East and South-West. I have used 0.008 as it is approximately 1Km. Reference
public static LatLng calculateNorthEast(double latitude, double longitude, double distance) {
double lat1 = Math.toRadians(latitude);
double deltaLat = distance * 0.008;
double deltaLon = distance / Math.cos(lat1)*0.008;
double lat2 = latitude + deltaLat;
double lon2 = longitude + deltaLon;
return new LatLng(lat2, lon2, 0);
}
public static LatLng calculateSouthWest(double latitude, double longitude, double distance) {
double lat1 = Math.toRadians(latitude);
double deltaLat = distance * 0.008;
double deltaLon = distance / Math.cos(lat1)*0.008;
double lat2 = latitude - deltaLat;
double lon2 = longitude - deltaLon;
return new LatLng(lat2, lon2, 0);
}
Can you please have a look at PR https://github.com/commons-app/apps-android-commons/pull/5658, Since I am getting same problem.
Can you run in debug mode, note down the result of each function, and draw these two points on the map above?
I have tested and these are the points (25.523992142085177,85.04935220271054) and (25.683992142085174,85.22677465886173)
I have plotted them on the map and are marked with (heart).
The points seem correctly positioned.
I am looking into it and will share an update in 2 days (currently I am out of station)