OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
geoToH3

Functions

EXTENSION_NOINLINE H3Index
H3_EXPORT() 
geoToH3 (const double lon, const double lat, int res)
 find the H3 index of the resolution res cell containing the lat/lng More...
 

Detailed Description

Functions for geoToH3

Function Documentation

EXTENSION_NOINLINE H3Index H3_EXPORT() geoToH3 ( const double  lon,
const double  lat,
int  res 
)

find the H3 index of the resolution res cell containing the lat/lng

Definition at line 730 of file h3Index.hpp.

References _faceIjkToH3(), _geoToFaceIjk(), degsToRads(), FaceIJK, GeoCoord, H3_NULL, MAX_H3_RES, and run_benchmark_import::res.

732  {
733  if (res < 0 || res > MAX_H3_RES) {
734  return H3_NULL;
735  }
736  if (!std::isfinite(lat) || !std::isfinite(lon)) {
737  return H3_NULL;
738  }
739 
740  FaceIJK(fijk);
741  GeoCoord(g) = {degsToRads(lat), degsToRads(lon)};
742  _geoToFaceIjk(g, res, fijk);
743  return _faceIjkToH3(fijk, res);
744 }
#define GeoCoord(variable_name)
Definition: h3api.h:94
#define FaceIJK(variable_name)
Definition: faceijk.h:36
EXTENSION_NOINLINE H3Index _faceIjkToH3(const FaceIJK(fijk), int res)
Definition: h3Index.hpp:643
#define MAX_H3_RES
Definition: constants.h:68
#define H3_NULL
Definition: h3Index.h:165
EXTENSION_INLINE double H3_EXPORT() degsToRads(double degrees)
converts degrees to radians
Definition: geoCoord.hpp:101
EXTENSION_NOINLINE bool _geoToFaceIjk(const GeoCoord(g), int res, FaceIJK(h))
Definition: faceijk.hpp:362

+ Here is the call graph for this function: