Exemple #1
0
        // 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));
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 private static extern void h3ToGeo(ulong h3, ref H3GeoCoord g);
Exemple #4
0
 private static extern ulong geoToH3(ref H3GeoCoord g, int res);
Exemple #5
0
 public GeoCoord(H3GeoCoord coord)
 {
     latitude  = H3Standard.H3.RadToDeg(coord.lat);
     longitude = H3Standard.H3.RadToDeg(coord.lon);
 }