OSMServer/Importer/Coordinates.cs

27 lines
586 B
C#
Raw Normal View History

2023-02-02 19:03:00 +01:00
using System.Diagnostics;
namespace OSMServer;
public class Coordinates
{
public float lat { get; }
public float lon { get; }
public Coordinates(float lat, float lon)
{
this.lat = lat;
this.lon = lon;
}
public uint GetHash()
{
return Convert.ToUInt32((this.lat * 10000f + this.lon) * 10000f);
}
public uint GetRegionHash()
{
float latRegion = this.lat % Importer.regionSize;
float lonRegion = this.lon % Importer.regionSize;
return new Coordinates(latRegion, lonRegion).GetHash();
}
}