Changed RegionIdFromCoordinates to return for latitude +90 and longitude +180 to avoid negatives.
This commit is contained in:
parent
4f98563a1e
commit
f122a5fadf
@ -6,8 +6,8 @@ public static class RegionUtils
|
||||
{
|
||||
public static long GetRegionIdFromCoordinates(float lat, float lon, float regionSize)
|
||||
{
|
||||
string latStr = $"{Math.Floor(lat / regionSize):000000}".Replace(".","").Replace(",", "");
|
||||
string lonStr = $"{Math.Floor(lon / regionSize):000000}".Replace(".","").Replace(",", "");
|
||||
string latStr = $"{Math.Floor((90 + lat) / regionSize):000000}";
|
||||
string lonStr = $"{Math.Floor((180 + lon) / regionSize):000000}";
|
||||
return long.Parse(string.Concat(latStr, lonStr));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user