Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PostGIS 3.5.0 #13

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
postgis--*.zip
*.pyc
__pycache__
/.venv
2 changes: 1 addition & 1 deletion MANIFEST.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "postgis"
version = "3.4.3"
version = "3.5.0"
files = ["postgis.edgeql"]
postgres_files = "pg"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from inside an edgedb development venv.

To build, install, and test into a dev env:
- ``make``
- ``python scripts/gen_ext_postgis.py``
- ``make zip``
- ``edb load-ext postgis--3.4.3.zip``
- ``edb load-ext postgis--3.5.0.zip``
- ``edb test tests/test_edgeql_postgis.py``
2 changes: 1 addition & 1 deletion postgis
Submodule postgis updated 1036 files
109 changes: 72 additions & 37 deletions postgis.edgeql
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,17 @@
#


create extension package postgis version '3.4.3' {
create extension package postgis version '3.5.0' {
set ext_module := "ext::postgis";
set sql_extensions := ["postgis >=3.4.0,<4.0.0"];
set sql_extensions := ["postgis >=3.5.0,<4.0.0"];

set sql_setup_script := $$
-- Make it possible to have `!=`, `?!=`, and `not in` for geometry
CREATE FUNCTION edgedb.geo_neq(l edgedb.geometry, r edgedb.geometry)
RETURNS bool
LANGUAGE sql
STRICT
IMMUTABLE
AS 'SELECT not(l = r)';

CREATE OPERATOR <> (
LEFTARG = edgedb.geometry, RIGHTARG = edgedb.geometry,
PROCEDURE = edgedb.geo_neq,
COMMUTATOR = '<>'
);

-- All comparisons between box3d values need a cast to geometry, but
-- implicit cast to box creates ambiguity and prevents the implicit
-- cast to geometry for comparisons.
ALTER EXTENSION postgis DROP CAST (edgedb.box3d AS box);
DROP CAST (edgedb.box3d AS box);
$$;
set sql_teardown_script := $$
DROP OPERATOR <> (edgedb.geometry, edgedb.geometry);
DROP FUNCTION edgedb.geo_neq(l edgedb.geometry, r edgedb.geometry);
$$;

create module ext::postgis;

Expand Down Expand Up @@ -290,9 +272,18 @@ create extension package postgis version '3.4.3' {
$$;
};

# total operators: 35
# total operators: 36
##################################################

# Postgres only manages to inline this function if it isn't marked
# strict, and we want it to be inlined so that indexes work with it.
create function ext::postgis::op_neq(a: ext::postgis::geometry, b: ext::postgis::geometry) -> std::bool {
set volatility := 'Immutable';
set impl_is_strict := false;
set prefer_subquery_args := true;
using sql $$SELECT a <> b$$;
};

# Postgres only manages to inline this function if it isn't marked
# strict, and we want it to be inlined so that indexes work with it.
create function ext::postgis::op_overlaps(a: ext::postgis::geometry, b: ext::postgis::geometry) -> std::bool {
Expand Down Expand Up @@ -609,7 +600,7 @@ create extension package postgis version '3.4.3' {
};


# total functions: 453
# total functions: 459
##################################################

create function ext::postgis::to_geometry(a0: ext::postgis::box2d) -> ext::postgis::geometry {
Expand Down Expand Up @@ -1055,7 +1046,7 @@ create extension package postgis version '3.4.3' {
create function ext::postgis::lineextend(geom: ext::postgis::geometry, distance_forward: std::float64, distance_backward: std::float64 = 0.0) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: line, distance_forward, distance_backward=0.0 - Returns a line with the last and first segments extended the specified distance(s).';
create annotation description := 'args: line, distance_forward, distance_backward=0.0 - Returns a line extended forwards and backwards by specified distances.';
using sql function 'st_lineextend';
};

Expand Down Expand Up @@ -1232,6 +1223,20 @@ create extension package postgis version '3.4.3' {
using sql function 'st_ndims';
};

create function ext::postgis::hasz(a0: ext::postgis::geometry) -> std::bool {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geom - Checks if a geometry has a Z dimension.';
using sql function 'st_hasz';
};

create function ext::postgis::hasm(a0: ext::postgis::geometry) -> std::bool {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geom - Checks if a geometry has an M (measure) dimension.';
using sql function 'st_hasm';
};

create function ext::postgis::asewkt(a0: ext::postgis::geometry) -> std::str {
set volatility := 'Immutable';
set force_return_cast := true;
Expand Down Expand Up @@ -1700,6 +1705,14 @@ create extension package postgis version '3.4.3' {
using sql function 'postgis_proj_version';
};

create function ext::postgis::postgis_proj_compiled_version() -> optional std::str {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'Returns the version number of the PROJ library against which PostGIS was built.';
set impl_is_strict := false;
using sql function 'postgis_proj_compiled_version';
};

create function ext::postgis::postgis_wagyu_version() -> optional std::str {
set volatility := 'Immutable';
set force_return_cast := true;
Expand Down Expand Up @@ -1825,28 +1838,28 @@ create extension package postgis version '3.4.3' {
create function ext::postgis::simplify(a0: ext::postgis::geometry, a1: std::float64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geomA, tolerance - Returns a simplified version of a geometry, using the Douglas-Peucker algorithm.';
create annotation description := 'args: geom, tolerance - Returns a simplified representation of a geometry, using the Douglas-Peucker algorithm.';
using sql function 'st_simplify';
};

create function ext::postgis::simplify(a0: ext::postgis::geometry, a1: std::float64, a2: std::bool) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geomA, tolerance - Returns a simplified version of a geometry, using the Douglas-Peucker algorithm.';
create annotation description := 'args: geom, tolerance - Returns a simplified representation of a geometry, using the Douglas-Peucker algorithm.';
using sql function 'st_simplify';
};

create function ext::postgis::simplifyvw(a0: ext::postgis::geometry, a1: std::float64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geomA, tolerance - Returns a simplified version of a geometry, using the Visvalingam-Whyatt algorithm';
create annotation description := 'args: geom, tolerance - Returns a simplified representation of a geometry, using the Visvalingam-Whyatt algorithm';
using sql function 'st_simplifyvw';
};

create function ext::postgis::seteffectivearea(a0: ext::postgis::geometry, a1: std::float64 = -1, a2: std::int64 = 1) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geomA, threshold = 0, set_area = 1 - Sets the effective area for each vertex, using the Visvalingam-Whyatt algorithm.';
create annotation description := 'args: geom, threshold = 0, set_area = 1 - Sets the effective area for each vertex, using the Visvalingam-Whyatt algorithm.';
using sql $$SELECT st_seteffectivearea("a0", "a1", "a2"::int4)$$;
};

Expand Down Expand Up @@ -2131,14 +2144,14 @@ create extension package postgis version '3.4.3' {
create function ext::postgis::generatepoints(area: ext::postgis::geometry, npoints: std::int64) -> ext::postgis::geometry {
set volatility := 'Volatile';
set force_return_cast := true;
create annotation description := 'args: g, npoints - Generates random points contained in a Polygon or MultiPolygon.';
create annotation description := 'args: g, npoints, seed = 0 - Generates a multipoint of random points contained in a Polygon or MultiPolygon.';
using sql $$SELECT st_generatepoints("area", "npoints"::int4)$$;
};

create function ext::postgis::generatepoints(area: ext::postgis::geometry, npoints: std::int64, seed: std::int64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: g, npoints - Generates random points contained in a Polygon or MultiPolygon.';
create annotation description := 'args: g, npoints, seed = 0 - Generates a multipoint of random points contained in a Polygon or MultiPolygon.';
using sql $$SELECT st_generatepoints("area", "npoints"::int4, "seed"::int4)$$;
};

Expand All @@ -2152,7 +2165,7 @@ create extension package postgis version '3.4.3' {
create function ext::postgis::simplifypreservetopology(a0: ext::postgis::geometry, a1: std::float64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geomA, tolerance - Returns a simplified and valid version of a geometry, using the Douglas-Peucker algorithm.';
create annotation description := 'args: geom, tolerance - Returns a simplified and valid representation of a geometry, using the Douglas-Peucker algorithm.';
using sql function 'st_simplifypreservetopology';
};

Expand Down Expand Up @@ -2716,6 +2729,7 @@ create extension package postgis version '3.4.3' {
create function ext::postgis::postgis_libjson_version() -> std::str {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'Returns the version number of the libjson-c library.';
using sql function 'postgis_libjson_version';
};

Expand Down Expand Up @@ -3402,13 +3416,6 @@ create extension package postgis version '3.4.3' {
using sql $$SELECT st_bdmpolyfromtext("a0", "a1"::int4)$$;
};

create function ext::postgis::longtransactionsenabled() -> optional std::bool {
set volatility := 'Volatile';
set force_return_cast := true;
set impl_is_strict := false;
using sql function 'longtransactionsenabled';
};

create function ext::postgis::to_geography(a0: std::bytes) -> ext::postgis::geography {
set volatility := 'Immutable';
set force_return_cast := true;
Expand Down Expand Up @@ -3546,6 +3553,20 @@ create extension package postgis version '3.4.3' {
using sql function 'st_linetocurve';
};

create function ext::postgis::numcurves(geometry: ext::postgis::geometry) -> std::int64 {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: a_compoundcurve - Return the number of component curves in a CompoundCurve.';
using sql function 'st_numcurves';
};

create function ext::postgis::curven(geometry: ext::postgis::geometry, i: std::int64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: a_compoundcurve, index - Returns the Nth component curve geometry of a CompoundCurve.';
using sql $$SELECT st_curven("geometry", "i"::int4)$$;
};

create function ext::postgis::point(a0: std::float64, a1: std::float64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
Expand Down Expand Up @@ -3658,6 +3679,20 @@ create extension package postgis version '3.4.3' {
using sql function 'st_3dlineinterpolatepoint';
};

create function ext::postgis::removeirrelevantpointsforview(a0: ext::postgis::geometry, a1: ext::postgis::box2d, a2: std::bool = false) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geom, bounds, cartesian_hint = false - Removes points that are irrelevant for rendering a specific rectangluar view of a geometry.';
using sql function 'st_removeirrelevantpointsforview';
};

create function ext::postgis::removesmallparts(a0: ext::postgis::geometry, a1: std::float64, a2: std::float64) -> ext::postgis::geometry {
set volatility := 'Immutable';
set force_return_cast := true;
create annotation description := 'args: geom, minSizeX, minSizeY - Removes small parts (polygon rings or linestrings) of a geometry.';
using sql function 'st_removesmallparts';
};


# total aggregates: 11
##################################################
Expand Down
Loading