OmniSciDB  b28c0d5765
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeoRasterTableFunctions.h File Reference
#include <vector>
#include "QueryEngine/heavydbTypes.h"
#include "GeoRasterTableFunctions.cpp"
+ Include dependency graph for GeoRasterTableFunctions.h:

Go to the source code of this file.

Classes

struct  ComputeAgg< AggType >
 
struct  ComputeAgg< RasterAggType::COUNT >
 
struct  ComputeAgg< RasterAggType::MAX >
 
struct  ComputeAgg< RasterAggType::MIN >
 
struct  ComputeAgg< RasterAggType::SUM >
 
struct  ComputeAgg< RasterAggType::BOX_AVG >
 
struct  GeoRaster< T, Z >
 

Enumerations

enum  RasterAggType {
  RasterAggType::COUNT, RasterAggType::MIN, RasterAggType::MAX, RasterAggType::SUM,
  RasterAggType::AVG, RasterAggType::GAUSS_AVG, RasterAggType::BOX_AVG, RasterAggType::INVALID
}
 

Functions

RasterAggType get_raster_agg_type (const std::string &agg_type_str, const bool is_fill_agg)
 
template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t geo_rasterize_impl (TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const RasterAggType raster_agg_type, const RasterAggType raster_fill_agg_type, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z)
 
template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize__cpu_template (TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const TextEncodingNone &agg_type_str, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z)
 
template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize__cpu_template (TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const TextEncodingNone &agg_type_str, const TextEncodingNone &fill_agg_type_str, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z)
 
template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize__cpu_template (TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const TextEncodingNone &agg_type_str, const TextEncodingNone &fill_agg_type_str, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, const T x_min, const T x_max, const T y_min, const T y_max, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z)
 
template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize_slope__cpu_template (TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const TextEncodingNone &agg_type_str, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, const bool compute_slope_in_degrees, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z, Column< Z > &output_slope, Column< Z > &output_aspect)
 

Enumeration Type Documentation

Function Documentation

template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t geo_rasterize_impl ( TableFunctionManager mgr,
const Column< T > &  input_x,
const Column< T > &  input_y,
const Column< Z > &  input_z,
const RasterAggType  raster_agg_type,
const RasterAggType  raster_fill_agg_type,
const T  bin_dim_meters,
const bool  geographic_coords,
const int64_t  neighborhood_fill_radius,
const bool  fill_only_nulls,
Column< T > &  output_x,
Column< T > &  output_y,
Column< Z > &  output_z 
)

Definition at line 267 of file GeoRasterTableFunctions.h.

References GeoRaster< T, Z >::fill_bins_from_neighbors(), GeoRaster< T, Z >::outputDenseColumns(), and GeoRaster< T, Z >::setMetadata().

Referenced by tf_geo_rasterize__cpu_template().

279  {
280  GeoRaster<T, Z> geo_raster(input_x,
281  input_y,
282  input_z,
283  raster_agg_type,
284  bin_dim_meters,
285  geographic_coords,
286  true);
287 
288  geo_raster.setMetadata(mgr);
289 
290  if (neighborhood_fill_radius > 0) {
291  geo_raster.fill_bins_from_neighbors(
292  neighborhood_fill_radius, fill_only_nulls, raster_fill_agg_type);
293  }
294 
295  return geo_raster.outputDenseColumns(mgr, output_x, output_y, output_z);
296 }

+ Here is the call graph for this function:

+ 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 27 of file GeoRasterTableFunctions.h.

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

Referenced by tf_geo_rasterize__cpu_template(), and tf_geo_rasterize_slope__cpu_template().

28  {
29  const auto upper_agg_type_str = to_upper(agg_type_str);
30  const static std::map<std::string, RasterAggType> agg_type_map = {
31  {"COUNT", RasterAggType::COUNT},
32  {"MIN", RasterAggType::MIN},
33  {"MAX", RasterAggType::MAX},
34  {"SUM", RasterAggType::SUM},
35  {"AVG", RasterAggType::AVG},
36  {"GAUSS_AVG", RasterAggType::GAUSS_AVG},
37  {"BOX_AVG", RasterAggType::BOX_AVG}};
38  const auto itr = agg_type_map.find(upper_agg_type_str);
39  if (itr == agg_type_map.end()) {
41  }
42  if (is_fill_agg && itr->second == RasterAggType::AVG) {
44  } else if (!is_fill_agg && (itr->second == RasterAggType::BOX_AVG ||
45  itr->second == RasterAggType::GAUSS_AVG)) {
46  // GAUSS_AVG and BOX_AVG are fill-only aggregates
48  }
49  return itr->second;
50 }
std::string to_upper(const std::string &str)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize__cpu_template ( TableFunctionManager mgr,
const Column< T > &  input_x,
const Column< T > &  input_y,
const Column< Z > &  input_z,
const TextEncodingNone agg_type_str,
const T  bin_dim_meters,
const bool  geographic_coords,
const int64_t  neighborhood_fill_radius,
const bool  fill_only_nulls,
Column< T > &  output_x,
Column< T > &  output_y,
Column< Z > &  output_z 
)

Definition at line 311 of file GeoRasterTableFunctions.h.

References GAUSS_AVG, geo_rasterize_impl(), get_raster_agg_type(), TextEncodingNone::getString(), and INVALID.

322  {
323  const auto raster_agg_type = get_raster_agg_type(agg_type_str, false);
324  if (raster_agg_type == RasterAggType::INVALID) {
325  const std::string error_msg =
326  "Invalid Raster Aggregate Type: " + agg_type_str.getString();
327  return mgr.ERROR_MESSAGE(error_msg);
328  }
329  return geo_rasterize_impl(mgr,
330  input_x,
331  input_y,
332  input_z,
333  raster_agg_type,
335  bin_dim_meters,
336  geographic_coords,
337  neighborhood_fill_radius,
338  fill_only_nulls,
339  output_x,
340  output_y,
341  output_z);
342 }
std::string getString() const
Definition: heavydbTypes.h:276
TEMPLATE_NOINLINE int32_t geo_rasterize_impl(TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const RasterAggType raster_agg_type, const RasterAggType raster_fill_agg_type, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z)
RasterAggType get_raster_agg_type(const std::string &agg_type_str, const bool is_fill_agg)

+ Here is the call graph for this function:

template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize__cpu_template ( TableFunctionManager mgr,
const Column< T > &  input_x,
const Column< T > &  input_y,
const Column< Z > &  input_z,
const TextEncodingNone agg_type_str,
const TextEncodingNone fill_agg_type_str,
const T  bin_dim_meters,
const bool  geographic_coords,
const int64_t  neighborhood_fill_radius,
const bool  fill_only_nulls,
Column< T > &  output_x,
Column< T > &  output_y,
Column< Z > &  output_z 
)

Definition at line 357 of file GeoRasterTableFunctions.h.

References geo_rasterize_impl(), get_raster_agg_type(), TextEncodingNone::getString(), and INVALID.

369  {
370  const auto raster_agg_type = get_raster_agg_type(agg_type_str, false);
371  if (raster_agg_type == RasterAggType::INVALID) {
372  const std::string error_msg =
373  "Invalid Raster Aggregate Type: " + agg_type_str.getString();
374  return mgr.ERROR_MESSAGE(error_msg);
375  }
376  const auto raster_fill_agg_type = get_raster_agg_type(fill_agg_type_str, true);
377  if (raster_fill_agg_type == RasterAggType::INVALID) {
378  const std::string error_msg =
379  "Invalid Raster Fill Aggregate Type: " + fill_agg_type_str.getString();
380  return mgr.ERROR_MESSAGE(error_msg);
381  }
382  return geo_rasterize_impl(mgr,
383  input_x,
384  input_y,
385  input_z,
386  raster_agg_type,
387  raster_fill_agg_type,
388  bin_dim_meters,
389  geographic_coords,
390  neighborhood_fill_radius,
391  fill_only_nulls,
392  output_x,
393  output_y,
394  output_z);
395 }
std::string getString() const
Definition: heavydbTypes.h:276
TEMPLATE_NOINLINE int32_t geo_rasterize_impl(TableFunctionManager &mgr, const Column< T > &input_x, const Column< T > &input_y, const Column< Z > &input_z, const RasterAggType raster_agg_type, const RasterAggType raster_fill_agg_type, const T bin_dim_meters, const bool geographic_coords, const int64_t neighborhood_fill_radius, const bool fill_only_nulls, Column< T > &output_x, Column< T > &output_y, Column< Z > &output_z)
RasterAggType get_raster_agg_type(const std::string &agg_type_str, const bool is_fill_agg)

+ Here is the call graph for this function:

template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize__cpu_template ( TableFunctionManager mgr,
const Column< T > &  input_x,
const Column< T > &  input_y,
const Column< Z > &  input_z,
const TextEncodingNone agg_type_str,
const TextEncodingNone fill_agg_type_str,
const T  bin_dim_meters,
const bool  geographic_coords,
const int64_t  neighborhood_fill_radius,
const bool  fill_only_nulls,
const T  x_min,
const T  x_max,
const T  y_min,
const T  y_max,
Column< T > &  output_x,
Column< T > &  output_y,
Column< Z > &  output_z 
)

Definition at line 411 of file GeoRasterTableFunctions.h.

References GeoRaster< T, Z >::fill_bins_from_neighbors(), get_raster_agg_type(), TextEncodingNone::getString(), INVALID, GeoRaster< T, Z >::outputDenseColumns(), and GeoRaster< T, Z >::setMetadata().

427  {
428  const auto raster_agg_type = get_raster_agg_type(agg_type_str, false);
429  if (raster_agg_type == RasterAggType::INVALID) {
430  const std::string error_msg =
431  "Invalid Raster Aggregate Type: " + agg_type_str.getString();
432  return mgr.ERROR_MESSAGE(error_msg);
433  }
434  const auto raster_fill_agg_type = get_raster_agg_type(fill_agg_type_str, true);
435  if (raster_fill_agg_type == RasterAggType::INVALID) {
436  const std::string error_msg =
437  "Invalid Raster Fill Aggregate Type: " + fill_agg_type_str.getString();
438  return mgr.ERROR_MESSAGE(error_msg);
439  }
440 
441  GeoRaster<T, Z> geo_raster(input_x,
442  input_y,
443  input_z,
444  raster_agg_type,
445  bin_dim_meters,
446  geographic_coords,
447  true,
448  x_min,
449  x_max,
450  y_min,
451  y_max);
452 
453  geo_raster.setMetadata(mgr);
454 
455  if (neighborhood_fill_radius > 0) {
456  geo_raster.fill_bins_from_neighbors(
457  neighborhood_fill_radius, fill_only_nulls, raster_fill_agg_type);
458  }
459 
460  return geo_raster.outputDenseColumns(mgr, output_x, output_y, output_z);
461 }
std::string getString() const
Definition: heavydbTypes.h:276
RasterAggType get_raster_agg_type(const std::string &agg_type_str, const bool is_fill_agg)

+ Here is the call graph for this function:

template<typename T , typename Z >
TEMPLATE_NOINLINE int32_t tf_geo_rasterize_slope__cpu_template ( TableFunctionManager mgr,
const Column< T > &  input_x,
const Column< T > &  input_y,
const Column< Z > &  input_z,
const TextEncodingNone agg_type_str,
const T  bin_dim_meters,
const bool  geographic_coords,
const int64_t  neighborhood_fill_radius,
const bool  fill_only_nulls,
const bool  compute_slope_in_degrees,
Column< T > &  output_x,
Column< T > &  output_y,
Column< Z > &  output_z,
Column< Z > &  output_slope,
Column< Z > &  output_aspect 
)

Definition at line 475 of file GeoRasterTableFunctions.h.

References GeoRaster< T, Z >::calculate_slope_and_aspect(), GeoRaster< T, Z >::fill_bins_from_neighbors(), GAUSS_AVG, get_raster_agg_type(), TextEncodingNone::getString(), INVALID, GeoRaster< T, Z >::outputDenseColumns(), and GeoRaster< T, Z >::setMetadata().

489  {
490  const auto raster_agg_type = get_raster_agg_type(agg_type_str, false);
491  if (raster_agg_type == RasterAggType::INVALID) {
492  const std::string error_msg =
493  "Invalid Raster Aggregate Type: " + agg_type_str.getString();
494  return mgr.ERROR_MESSAGE(error_msg);
495  }
496 
497  GeoRaster<T, Z> geo_raster(input_x,
498  input_y,
499  input_z,
500  raster_agg_type,
501  bin_dim_meters,
502  geographic_coords,
503  true);
504  geo_raster.setMetadata(mgr);
505 
506  if (neighborhood_fill_radius > 0) {
507  geo_raster.fill_bins_from_neighbors(
508  neighborhood_fill_radius, fill_only_nulls, RasterAggType::GAUSS_AVG);
509  }
510 
511  const size_t output_rows =
512  geo_raster.outputDenseColumns(mgr, output_x, output_y, output_z);
513  geo_raster.calculate_slope_and_aspect(
514  output_slope, output_aspect, compute_slope_in_degrees);
515  return output_rows;
516 }
std::string getString() const
Definition: heavydbTypes.h:276
RasterAggType get_raster_agg_type(const std::string &agg_type_str, const bool is_fill_agg)

+ Here is the call graph for this function: