SQL Extensions

HEAVY.AI implements a number of custom extension functions to SQL.

Rendering

The following table describes SQL extensions available for the HEAVY.AI implementation of Vega.

SQL SELECT

Function
Arguments and Return

convert_meters_to_merc_pixel_width(meters, lon, lat, min_lon, max_lon, img_width, min_width)

Converts a distance in meters in a longitudinal direction from a latitude/longitude coordinate to a pixel size using mercator projection:

  • meters: Distance in meters in a longitudinal direction to convert to pixel units.

  • lon: Longitude coordinate of the center point to size from.

  • lat: Latitude coordinate of the center point to size from.

  • min_lon: Minimum longitude coordinate of the mercator-projected view.

  • max_lon: Maximum longitude coordinate of the mercator-projected view.

  • img_width: The width in pixels of the view.

  • min_width: Clamps the returned pixel size to be at least this width.

Returns: Floating-point value in pixel units. Can be used for the width of a symbol or a point in Vega.

convert_meters_to_merc_pixel_height(meters, lon, lat, min_lat, max_lat, img_height, min_height)

Converts a distance in meters in a latitudinal direction from a latitude/longitude coordinate to a pixel size, using mercator projection:

  • meters: Distance in meters in a longitudinal direction to convert to pixel units.

  • lon: Longitude coordinate of the center point to size from.

  • lat: Latitude coordinate of the center point to size from.

  • min_lat: Minimum latitude coordinate of the mercator-projected view.

  • max_lat: Maximum latitude coordinate of the mercator-projected view.

  • img_height: The height in pixels of the view.

  • min_height: Clamps the returned pixel size to be at least this height.

Returns: Floating-point value in pixel units. Can be used for the height of a symbol or a point in Vega.

convert_meters_to_pixel_width(meters, pt, min_lon, max_lon, img_width, min_width)

Converts a distance in meters in a longitudinal direction from a latitude/longitude POINT to a pixel size. Supports only mercator-projected points.

  • meters: Distance in meters in a latitudinal direction to convert to pixel units.

  • pt: The center POINT to size from. The point must be defined in the EPSG:4326 spatial reference system.

  • min_lon: Minimum longitude coordinate of the mercator-projected view.

  • max_lon: Maximum longitude coordinate of the mercator-projected view.

  • img_width: The width in pixels of the view.

  • min_width: Clamps the returned pixel size to be at least this width.

Returns: Floating-point value in pixel units. Can be used for the width of a symbol or a point in Vega.

convert_meters_to_pixel_height(meters, pt, min_lat, max_lat, img_height, min_height)

Converts a distance in meters in a latitudinal direction from an EPSG:4326 POINT to a pixel size. Currently only supports mercator-projected points:

  • meters: Distance in meters in a longitudinal direction to convert to pixel units.

  • pt: The center POINT to size from. The point must be defined in the EPSG:4326 spatial reference system.

  • min_lat: Minimum latitude coordinate of the mercator-projected view.

  • max_lat: Maximum latitude coordinate of the mercator-projected view.

  • img_height: The height in pixels of the view.

  • min_height: Clamps the returned pixel size to be at least this height.

Returns: Floating-point value in pixel units. Can be used for the height of a symbol or a point in Vega.

is_point_in_merc_view(lon, lat, min_lon, max_lon, min_lat, max_lat)

Returns true if a latitude/longitude coordinate is within a mercator-projected view defined by min_lon/max_lon, min_lat/max_lat.

  • lon: Longitude coordinate of the point.

  • lat: Latitude coordinate of the point.

  • min_lon: Minimum longitude coordinate of the mercator-projected view.

  • max_lon: Maximum longitude coordinate of the mercator-projected view.

  • min_lat: Minimum latitude coordinate of the mercator-projected view.

  • max_lat: Maximum latitude coordinate of the mercator-projected view.

Returns:True if the point is within the view defined by the min_lon/max_lon, min_lat/max_lat; otherwise, false.

is_point_size_in_merc_view(lon, lat, meters, min_lon, max_lon, min_lat, max_lat)

Returns true if a latitude/longitude coordinate, offset by a distance in meters, is within a mercator-projected view defined by min_lon/max_lon, min_lat/max_lat.

  • lon: Longitude coordinate of the point.

  • lat: Latitude coordinate of the point.

  • meters: Distance in meters to offset the point by, in any direction.

  • min_lon: Minimum longitude coordinate of the mercator-projected view.

  • max_lon: Maximum longitude coordinate of the mercator-projected view.

  • min_lat: Minimum latitude coordinate of the mercator-projected view.

  • max_lat: Maximum latitude coordinate of the mercator-projected view.

Returns: True if the point is within the view defined by the min_lon/max_lon, min_lat/max_lat; otherwise, false.

is_point_in_view(pt, min_lon, max_lon, min_lat, max_lat)

Returns true if a latitude/longitude POINT defined in EPSG:4326 is within a mercator-projected view defined by min_lon/max_lon, min_lat/max_lat.

  • pt: The POINT to check. Must be defined in EPSG:4326 spatial reference system.

  • min_lon: Minimum longitude coordinate of the mercator-projected view.

  • max_lon: Maximum longitude coordinate of the mercator-projected view.

  • min_lat: Minimum latitude coordinate of the mercator-projected view.

  • max_lat: Maximum latitude coordinate of the mercator-projected view.

Returns: True if the point is within the view defined by min_lon/max_lon, min_lat/max_lat; otherwise, false.

is_point_size_in_view(pt, meters, min_lon, max_lon, min_lat, max_lat)

Returns true if a latitude/longitude POINT defined in EPSG:4326 is within a mercator-projected view defined by min_lon/max_lon, min_lat/max_lat.

  • pt: The POINT to check. Must be defined in EPSG:4326 spatial reference system.

  • meters: Distance in meters to offset the point by, in any direction.

  • min_lon: Minimum longitude coordinate of the mercator-projected view.

  • max_lon: Maximum longitude coordinate of the mercator-projected view.

  • min_lat: Minimum latitude coordinate of the mercator-projected view.

  • max_lat: Maximum latitude coordinate of the mercator-projected view.

Returns: True if a latitude/longitude POINT defined in EPSG:4326, offset by a distance in meters, is within the view defined by min_lon/max_lon, min_lat/max_lat; otherwise, false.

Last updated