Changed RegionIdFromCoordinates to return for latitude +90 and longitude +180 to avoid negatives.

This commit is contained in:
glax 2024-07-23 23:19:17 +02:00
parent 4f98563a1e
commit f122a5fadf

View File

@ -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));
}