OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeoRasterTableFunctions.cpp File Reference
+ Include dependency graph for GeoRasterTableFunctions.cpp:

Go to the source code of this file.

Functions

RasterAggType get_raster_agg_type (const std::string &agg_type_str, const bool is_fill_agg)
 
std::vector< double > generate_1d_gaussian_kernel (const int64_t fill_radius, double sigma)
 

Function Documentation

std::vector<double> generate_1d_gaussian_kernel ( const int64_t  fill_radius,
double  sigma 
)

Definition at line 46 of file GeoRasterTableFunctions.cpp.

References M_PI.

Referenced by GeoRaster< T, Z >::fill_bins_from_gaussian_neighborhood().

46  {
47  const int64_t kernel_size = fill_radius * 2 + 1;
48  std::vector<double> gaussian_kernel(kernel_size);
49  const double expr = 1.0 / (sigma * sqrt(2.0 * M_PI));
50  for (int64_t kernel_idx = -fill_radius; kernel_idx <= fill_radius; ++kernel_idx) {
51  gaussian_kernel[kernel_idx + fill_radius] =
52  expr * exp((kernel_idx * kernel_idx) / (-2.0 * (sigma * sigma)));
53  }
54  return gaussian_kernel;
55 }
#define M_PI
Definition: constants.h:25

+ Here is the caller graph for this function:

RasterAggType get_raster_agg_type ( const std::string &  agg_type_str,
const bool  is_fill_agg 
)

Definition at line 21 of file GeoRasterTableFunctions.cpp.

References AVG, BOX_AVG, COUNT, GAUSS_AVG, INVALID, MAX, MIN, SUM, and to_upper().

Referenced by tf_geo_multi_rasterize__cpu_template(), tf_geo_rasterize__cpu_template(), tf_geo_rasterize_slope__cpu_template(), and GDALTableFunctions::tf_raster_contour_rasterize_impl().

22  {
23  const auto upper_agg_type_str = to_upper(agg_type_str);
24  const static std::map<std::string, RasterAggType> agg_type_map = {
25  {"COUNT", RasterAggType::COUNT},
26  {"MIN", RasterAggType::MIN},
27  {"MAX", RasterAggType::MAX},
28  {"SUM", RasterAggType::SUM},
29  {"AVG", RasterAggType::AVG},
30  {"GAUSS_AVG", RasterAggType::GAUSS_AVG},
31  {"BOX_AVG", RasterAggType::BOX_AVG}};
32  const auto itr = agg_type_map.find(upper_agg_type_str);
33  if (itr == agg_type_map.end()) {
35  }
36  if (is_fill_agg && itr->second == RasterAggType::AVG) {
38  } else if (!is_fill_agg && (itr->second == RasterAggType::BOX_AVG ||
39  itr->second == RasterAggType::GAUSS_AVG)) {
40  // GAUSS_AVG and BOX_AVG are fill-only aggregates
42  }
43  return itr->second;
44 }
std::string to_upper(const std::string &str)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: