// INDEXING public static ulong GeoToH3(double latitude, double longitude, int resolution) { var coord = new H3GeoCoord { lat = DegToRad(latitude), lon = DegToRad(longitude) }; return(geoToH3(ref coord, resolution)); }
public static (double latitude, double longitude) GetCenter(ulong index) { H3GeoCoord geoCoord = new H3GeoCoord(); h3ToGeo(index, ref geoCoord); if (geoCoord.lon > 180) { geoCoord.lon -= 360; } GeoCoord coords = new GeoCoord(geoCoord); return(coords.latitude, coords.longitude); }
private static extern void h3ToGeo(ulong h3, ref H3GeoCoord g);
private static extern ulong geoToH3(ref H3GeoCoord g, int res);
public GeoCoord(H3GeoCoord coord) { latitude = H3Standard.H3.RadToDeg(coord.lat); longitude = H3Standard.H3.RadToDeg(coord.lon); }