Skip to content

Commit

Permalink
Add failing tests for upgrade path
Browse files Browse the repository at this point in the history
  • Loading branch information
zachasme committed Oct 5, 2022
1 parent 75d5860 commit 92e8f05
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 51 deletions.
80 changes: 40 additions & 40 deletions h3/sql/updates/h3--0.1.0--0.2.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,158 +19,158 @@

-- Indexing functions (indexing.c)
CREATE OR REPLACE FUNCTION h3_geo_to_h3(point, resolution integer) RETURNS h3index
AS 'h3', 'h3_lat_lng_to_cell' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_geo_to_h3(point, resolution integer) IS
'Indexes the location at the specified resolution';
CREATE OR REPLACE FUNCTION h3_h3_to_geo(h3index) RETURNS point
AS 'h3', 'h3_cell_to_lat_lng' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_to_geo(h3index) IS
'Finds the centroid of the index';
CREATE OR REPLACE FUNCTION h3_h3_to_geo_boundary(h3index) RETURNS polygon
AS 'h3', 'h3_cell_to_boundary' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_to_geo_boundary(h3index) IS
'Finds the boundary of the index';

-- Index inspection functions (inspection.c)
CREATE OR REPLACE FUNCTION h3_h3_get_resolution(h3index) RETURNS integer
AS 'h3', 'h3_get_resolution' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_get_resolution(h3index) IS
'Returns the resolution of the index';
CREATE OR REPLACE FUNCTION h3_h3_get_base_cell(h3index) RETURNS integer
AS 'h3', 'h3_get_base_cell_number' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_get_base_cell(h3index) IS
'Returns the base cell number of the index';
CREATE OR REPLACE FUNCTION h3_h3_is_valid(h3index) RETURNS bool
AS 'h3', 'h3_is_valid_cell' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_is_valid(h3index) IS
'Returns true if the given H3Index is valid';
CREATE OR REPLACE FUNCTION h3_h3_is_res_class_iii(h3index) RETURNS bool
AS 'h3', 'h3_is_res_class_iii' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_is_res_class_iii(h3index) IS
'Returns true if this index has a resolution with Class III orientation';
CREATE OR REPLACE FUNCTION h3_h3_is_pentagon(h3index) RETURNS bool
AS 'h3', 'h3_is_pentagon' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_is_pentagon(h3index) IS
'Returns true if this index represents a pentagonal cell';

-- Grid traversal functions (traversal.c)
CREATE OR REPLACE FUNCTION h3_k_ring(h3index, k integer DEFAULT 1) RETURNS SETOF h3index
AS 'h3', 'h3_grid_disk' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_k_ring(h3index, k integer) IS
'Produces indices within "k" distance of the origin index';
CREATE OR REPLACE FUNCTION h3_k_ring_distances(h3index, k integer DEFAULT 1, OUT index h3index, OUT distance int) RETURNS SETOF record
AS 'h3', 'h3_grid_disk_distances' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_k_ring_distances(h3index, k integer) IS
'Produces indices within "k" distance of the origin index paired with their distance to the origin';
CREATE OR REPLACE FUNCTION h3_hex_ring(h3index, k integer DEFAULT 1) RETURNS SETOF h3index
AS 'h3', 'h3_grid_ring_unsafe' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_hex_ring(h3index, k integer) IS
'Returns the hollow hexagonal ring centered at origin with distance "k"';
CREATE OR REPLACE FUNCTION h3_distance(h3index, h3index) RETURNS integer
AS 'h3', 'h3_grid_distance' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_distance(h3index, h3index) IS
'Returns the distance in grid cells between the two indices';
CREATE OR REPLACE FUNCTION h3_experimental_h3_to_local_ij(origin h3index, index h3index) RETURNS POINT
AS 'h3', 'h3_cell_to_local_ij' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_experimental_h3_to_local_ij(origin h3index, index h3index) IS
'Produces local IJ coordinates for an H3 index anchored by an origin.
This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.';
CREATE OR REPLACE FUNCTION h3_experimental_local_ij_to_h3(origin h3index, coord POINT) RETURNS h3index
AS 'h3', 'h3_local_ij_to_cell' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_experimental_local_ij_to_h3(origin h3index, coord POINT) IS
'Produces an H3 index from local IJ coordinates anchored by an origin.
This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.';

-- Hierarchical grid functions (hierarchy.c)
CREATE OR REPLACE FUNCTION h3_h3_to_parent(h3index, resolution integer DEFAULT -1) RETURNS h3index
AS 'h3', 'h3_cell_to_parent' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_to_parent(h3index, resolution integer) IS
'Returns the parent of the given index';
CREATE OR REPLACE FUNCTION h3_h3_to_children(h3index, resolution integer DEFAULT -1) RETURNS SETOF h3index
AS 'h3', 'h3_cell_to_children' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_to_children(index h3index, resolution integer) IS
'Returns the set of children of the given index';
CREATE OR REPLACE FUNCTION h3_compact(h3index[]) RETURNS SETOF h3index
AS 'h3', 'h3_compact_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_compact(h3index[]) IS
'Compacts the given array as best as possible';
CREATE OR REPLACE FUNCTION h3_uncompact(h3index[], resolution integer DEFAULT -1) RETURNS SETOF h3index
AS 'h3', 'h3_uncompact_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_uncompact(h3index[], resolution integer) IS
'Uncompacts the given array at the given resolution. If no resolution is given, then it is chosen as one higher than the highest resolution in the set';

-- Region functions (regions.c)
CREATE OR REPLACE FUNCTION h3_polyfill(exterior polygon, holes polygon[], resolution integer DEFAULT 1) RETURNS SETOF h3index
AS 'h3', 'h3_polygon_to_cells' LANGUAGE C IMMUTABLE PARALLEL SAFE; -- NOT STRICT
AS 'h3' LANGUAGE C IMMUTABLE PARALLEL SAFE; -- NOT STRICT
COMMENT ON FUNCTION h3_polyfill(exterior polygon, holes polygon[], resolution integer) IS
'Takes an exterior polygon [and a set of hole polygon] and returns the set of hexagons that best fit the structure';
CREATE OR REPLACE FUNCTION h3_h3_set_to_linked_geo(h3index[], OUT exterior polygon, OUT holes polygon[]) RETURNS SETOF record
AS 'h3', 'h3_cells_to_multi_polygon' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_set_to_linked_geo(h3index[]) IS
'Create a LinkedGeoPolygon describing the outline(s) of a set of hexagons. Polygon outlines will follow GeoJSON MultiPolygon order: Each polygon will have one outer loop, which is first in the list, followed by any holes';

-- Unidirectional edge functions (uniedges.c)
CREATE OR REPLACE FUNCTION h3_h3_indexes_are_neighbors(h3index, h3index) RETURNS boolean
AS 'h3', 'h3_are_neighbor_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_indexes_are_neighbors(h3index, h3index) IS
'Returns true if the given indices are neighbors';
CREATE OR REPLACE FUNCTION h3_get_h3_unidirectional_edge(origin h3index, destination h3index) RETURNS h3index
AS 'h3', 'h3_cells_to_directed_edge' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_h3_unidirectional_edge(origin h3index, destination h3index) IS
'Returns a unidirectional edge H3 index based on the provided origin and destination.';
CREATE OR REPLACE FUNCTION h3_h3_unidirectional_edge_is_valid(edge h3index) RETURNS boolean
AS 'h3', 'h3_is_valid_directed_edge' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_unidirectional_edge_is_valid(edge h3index) IS
'Returns true if the given edge is valid.';
CREATE OR REPLACE FUNCTION h3_get_origin_h3_index_from_unidirectional_edge(edge h3index) RETURNS h3index
AS 'h3', 'h3_get_directed_edge_origin' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_origin_h3_index_from_unidirectional_edge(edge h3index) IS
'Returns the origin index from the given edge.';
CREATE OR REPLACE FUNCTION h3_get_destination_h3_index_from_unidirectional_edge(edge h3index) RETURNS h3index
AS 'h3', 'h3_get_directed_edge_destination' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_destination_h3_index_from_unidirectional_edge(edge h3index) IS
'Returns the destination index from the given edge.';
CREATE OR REPLACE FUNCTION h3_get_h3_indexes_from_unidirectional_edge(edge h3index, OUT origin h3index, OUT destination h3index) RETURNS record
AS 'h3', 'h3_directed_edge_to_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_h3_indexes_from_unidirectional_edge(edge h3index) IS
'Returns the pair of indices from the given edge.';
CREATE OR REPLACE FUNCTION h3_get_h3_unidirectional_edges_from_hexagon(h3index) RETURNS SETOF h3index
AS 'h3', 'h3_origin_to_directed_edges' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_h3_unidirectional_edges_from_hexagon(h3index) IS
'Returns all unidirectional edges with the given index as origin';
CREATE OR REPLACE FUNCTION h3_get_unidirectional_edge_boundary(edge h3index) RETURNS polygon
AS 'h3', 'h3_directed_edge_to_boundary' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_unidirectional_edge_boundary(edge h3index) IS
'Provides the coordinates defining the unidirectional edge.';

-- Miscellaneous H3 functions (miscellaneous.c)
CREATE OR REPLACE FUNCTION h3_num_hexagons(resolution integer) RETURNS bigint
AS 'h3', 'h3_get_num_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_num_hexagons(resolution integer) IS
'Number of unique H3 indexes at the given resolution.';

-- DEPRECATED in v3.4.0
CREATE OR REPLACE FUNCTION h3_degs_to_rads(float) RETURNS float
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_rads_to_degs(float) RETURNS float
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- DEPRECATED in v3.5.0
CREATE OR REPLACE FUNCTION h3_hex_area_km2(integer) RETURNS float
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_hex_area_m2(integer) RETURNS float
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_edge_length_km(integer) RETURNS float
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_edge_length_m(integer) RETURNS float
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_hex_range(h3index, k integer) RETURNS SETOF h3index
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_hex_range_distances(h3index, k integer, OUT h3index, OUT int) RETURNS SETOF record
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_hex_ranges(h3index[], k integer) RETURNS SETOF h3index
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- DEPRECATED in v3.6.0
CREATE OR REPLACE FUNCTION h3_string_to_h3(cstring) RETURNS h3index
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION h3_h3_to_string(h3index) RETURNS cstring
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
4 changes: 2 additions & 2 deletions h3/sql/updates/h3--0.2.0--0.3.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-- Custom helper functions

CREATE OR REPLACE FUNCTION h3_basecells() RETURNS SETOF h3index
AS 'h3', 'h3_get_res_0_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_basecells() IS
'Returns all 122 basecells.';

Expand Down Expand Up @@ -97,4 +97,4 @@ CREATE CAST (h3index AS point) WITH FUNCTION h3_h3_to_geo(h3index);

-- DEPRECATED in v1.0.0
CREATE OR REPLACE FUNCTION h3_haversine_distance(h3index, h3index) RETURNS double precision
AS 'h3', 'h3index_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
2 changes: 1 addition & 1 deletion h3/sql/updates/h3--0.3.0--0.3.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DROP FUNCTION IF EXISTS h3_h3_to_geo_boundary_geometry(h3index);
DROP FUNCTION IF EXISTS h3_h3_to_geo_boundary_geography(h3index);

CREATE OR REPLACE FUNCTION h3_h3_to_geo_boundary(h3index, extend_at_meridian BOOLEAN DEFAULT FALSE) RETURNS polygon
AS 'h3', 'h3_cell_to_boundary' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_h3_to_geo_boundary(h3index, boolean) IS
'Finds the boundary of the index, second argument extends coordinates when crossing 180th meridian to help visualization';
--CREATE OR REPLACE FUNCTION h3_h3_to_geo_boundary_geometry(h3index, extend BOOLEAN DEFAULT FALSE) RETURNS geometry
Expand Down
2 changes: 1 addition & 1 deletion h3/sql/updates/h3--0.3.2--0.4.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
\echo Use "ALTER EXTENSION h3 UPDATE TO '0.4.0'" to load this file. \quit

CREATE OR REPLACE FUNCTION h3_line(h3index, h3index) RETURNS SETOF h3index
AS 'h3', 'h3_grid_path_cells' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_line(h3index, h3index) IS
'Given two H3 indexes, return the line of indexes between them (inclusive).
Expand Down
4 changes: 2 additions & 2 deletions h3/sql/updates/h3--3.4.1--3.5.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
\echo Use "ALTER EXTENSION h3 UPDATE TO '3.5.0'" to load this file. \quit

CREATE OR REPLACE FUNCTION h3_get_faces(h3index) RETURNS integer[]
AS 'h3', 'h3_get_icosahedron_faces' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_faces(h3index) IS
'Find all icosahedron faces intersected by a given H3 index';

Expand All @@ -35,7 +35,7 @@ CREATE OR REPLACE FUNCTION h3_edge_length(resolution integer, km boolean DEFAULT
DROP FUNCTION IF EXISTS h3_hex_area_km2(integer);
DROP FUNCTION IF EXISTS h3_hex_area_m2(integer);
CREATE OR REPLACE FUNCTION h3_hex_area(resolution integer, km boolean DEFAULT FALSE) RETURNS float
AS 'h3', 'h3_get_hexagon_area_avg' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_hex_area(integer, boolean) IS
'Average hexagon area in square (kilo)meters at the given resolution.';

Expand Down
4 changes: 2 additions & 2 deletions h3/sql/updates/h3--3.5.0--3.6.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

-- Hierarchical grid functions (hierarchy.c)
CREATE OR REPLACE FUNCTION h3_to_center_child(h3index, resolution integer DEFAULT -1) RETURNS h3index
AS 'h3', 'h3_cell_to_center_child' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_to_parent(h3index, resolution integer) IS
'Returns the center child (finer) index contained by input index at given resolution';

-- Miscellaneous H3 functions (miscellaneous.c)
CREATE OR REPLACE FUNCTION h3_get_pentagon_indexes(resolution integer) RETURNS SETOF h3index
AS 'h3', 'h3_get_pentagons' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_get_res_0_indexes() IS
'All the pentagon H3 indexes at the specified resolution.';

Expand Down
6 changes: 3 additions & 3 deletions h3/sql/updates/h3--3.6.5--3.7.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CREATE OPERATOR <-> (

-- New functions in core v3.7.0
CREATE OR REPLACE FUNCTION h3_point_dist(a point, b point, unit text DEFAULT 'km') RETURNS float
AS 'h3', 'h3_great_circle_distance' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_point_dist(point, point, text) IS
'The great circle distance in radians between two spherical coordinates.';

Expand All @@ -42,13 +42,13 @@ CREATE OR REPLACE FUNCTION h3_cell_area(cell h3index, unit text DEFAULT 'km^2')
'Exact area for a specific cell (hexagon or pentagon).';

CREATE OR REPLACE FUNCTION h3_exact_edge_length(edge h3index, unit text DEFAULT 'km') RETURNS float
AS 'h3', 'h3_edge_length' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_exact_edge_length(h3index, text) IS
'Exact length for a specific unidirectional edge.';

-- New call signatures for hexarea and edgelength, using string instead of boolean
CREATE OR REPLACE FUNCTION h3_hex_area(resolution integer, unit text DEFAULT 'km') RETURNS float
AS 'h3', 'h3_get_hexagon_area_avg' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
AS 'h3' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION h3_hex_area(integer, text) IS
'Average hexagon area in square (kilo)meters at the given resolution.';

Expand Down
Loading

0 comments on commit 92e8f05

Please sign in to comment.