# 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.
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.
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.
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.