Skip to content

Commit 2f3f798

Browse files
committed
GiST and SP-GiST n-D indexes (based on GIDX) with overlaps, contains, within, and equals operators
Patch by Esteban Zimányi and Arthur Lesuisse from Université Libre de Bruxelles (ULB) Closes postgis#327 Closes postgis#293 Closes #4230 git-svn-id: http://svn.osgeo.org/postgis/trunk@17001 b70326c6-7e19-0410-871a-916f4a2858ee
1 parent eced793 commit 2f3f798

File tree

12 files changed

+934
-787
lines changed

12 files changed

+934
-787
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ env:
99
- tag=pg11-geos37-gdal23-proj52
1010
- tag=pg10-geos36-gdal23-proj49
1111
- tag=pg96-geos36-gdal22-proj49
12-
- tag=pg95-geos36-gdal22-proj49
13-
- tag=pg94-geos35-gdal111-proj48
12+
- tag=pg95-geos35-gdal111-proj48
1413

1514
matrix:
1615
allow_failures:

NEWS

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,39 @@ PostGIS 3.0.0
22
2019/xx/xx
33
* Breaking Changes *
44
- #3888, Raster support now available as a separate extension
5-
(Sandro Santilli)
5+
(Sandro Santilli)
66
- #3807, Extension library files no longer include the minor version.
7-
Use New configure switch --with-library-minor-version
8-
if you need the old behavior (Regina Obe)
7+
Use New configure switch --with-library-minor-version
8+
if you need the old behavior (Regina Obe)
9+
- #4230, ND box operators (overlaps, contains, within, equals) now don't look on
10+
dimentions that aren't present in both operands.
11+
Please REINDEX your ND indexes after upgrade.
912

1013
* New Features *
1114
- #2902, postgis_geos_noop (Sandro Santilli)
1215
- #4128, ST_AsMVT support for Feature ID (Stepan Kuzmin)
16+
- #4230, SP-GiST and GiST support for ND box operators overlaps, contains,
17+
within, equals (Esteban Zimányi and Arthur Lesuisse from Université
18+
Libre de Bruxelles (ULB), Darafei Praliaskouski)
1319

1420
* Enhancements and fixes *
1521
- #4153, ST_Segmentize now splits segments proportionally (Darafei
16-
Praliaskouski).
22+
Praliaskouski).
1723
- #4162, ST_DWithin documentation examples for storing geometry and
18-
radius in table (Darafei Praliaskouski, github user Boscop).
24+
radius in table (Darafei Praliaskouski, github user Boscop).
1925
- #4161, MVT: Drop geometries smaller than the resolution (Raúl Marín)
2026
- #4176, ST_Intersects supports GEOMETRYCOLLECTION (Darafei Praliaskouski)
2127
- #4181, St_AsMVTGeom: Avoid type changes due to validation (Raúl Marín)
2228
- #4183, St_AsMVTGeom: Drop invalid geometries after simplification (Raúl Marín)
23-
- #4188, Avoid division by zero in kmeans (Raúl Marín)
29+
- #4188, Avoid division by zero in KMeans (Raúl Marín)
2430
- #4189, Fix undefined behaviour in SADFWrite (Raúl Marín)
2531
- #4191, Fix undefined behaviour in ptarray_clone_deep (Raúl Marín)
2632
- #4211, Fix ST_Subdivide for minimal exterior ring with minimal hole (Darafei
27-
Praliaskouski)
33+
Praliaskouski)
2834
- #3457, Fix raster envelope shortcut in ST_Clip (Sai-bot)
2935
- #4215, Use floating point compare in ST_DumpAsPolygons (Darafei Praliaskouski)
3036
- #4155, Support for GEOMETRYCOLLECTION, POLYGON, TIN, TRIANGLE in
31-
ST_LocateBetween and ST_LocateBetweenElevations (Darafei Praliaskouski)
37+
ST_LocateBetween and ST_LocateBetweenElevations (Darafei Praliaskouski)
3238
- #2767, Documentation for AddRasterConstraint optional parameters (Sunveer Singh)
3339

3440
PostGIS 2.5.0
@@ -39,9 +45,9 @@ PostgreSQL 9.4 - PostgreSQL 12 (in development)
3945
GEOS >= 3.5
4046

4147
* New Features *
42-
- #1847, spgist 2d and 3d support for PG 11+
43-
(Esteban Zimányi and Arthur Lesuisse from Université Libre de Bruxelles (ULB),
44-
Darafei Praliaskouski)
48+
- #1847, SP-GiST 2D and 3D support for PostgreSQL 11+ (Esteban Zimányi and
49+
Arthur Lesuisse from Université Libre de Bruxelles (ULB), Darafei
50+
Praliaskouski)
4551
- #4056, ST_FilterByM (Nicklas Avén)
4652
- #4050, ST_ChaikinSmoothing (Nicklas Avén)
4753
- #3989, ST_Buffer single sided option (Stephen Knox)
@@ -62,7 +68,7 @@ GEOS >= 3.5
6268
* Breaking Changes *
6369
- #4054, ST_SimplifyVW changed from > tolerance to >= tolerance
6470
- #3885, version number removed from address_standardize lib file
65-
(Regina Obe)
71+
(Regina Obe)
6672
- #3893, raster support functions can only be loaded in the same schema
6773
with core PostGIS functions. (Sandro Santilli)
6874
- #4035, remove dummy pgis_abs type from aggregate/collect routines.

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ if test "x$LIBLWGEOM_ONLY" = "xno"; then
483483
PGSQL_SHAREDIR=`"$PG_CONFIG" --sharedir`
484484

485485
AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])
486-
dnl Ensure that we are using PostgreSQL >= 9.4
487-
if test $POSTGIS_PGSQL_VERSION -lt 94; then
488-
AC_MSG_ERROR([PostGIS requires PostgreSQL >= 9.4])
486+
dnl Ensure that we are using PostgreSQL >= 9.5
487+
if test $POSTGIS_PGSQL_VERSION -lt 95; then
488+
AC_MSG_ERROR([PostGIS requires PostgreSQL >= 9.5])
489489
fi
490490

491491
HAVE_BRIN=no

libpgcommon/gserialized_gist.h

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ typedef struct
2626
#define GIDX_MAX_SIZE 36
2727
#define GIDX_MAX_DIM 4
2828

29-
3029
/*
3130
* This macro is based on PG_FREE_IF_COPY, except that it accepts two pointers.
3231
* See PG_FREE_IF_COPY comment in src/include/fmgr.h in postgres source code
3332
* for more details.
3433
*/
3534
#define POSTGIS_FREE_IF_COPY_P(ptrsrc, ptrori) \
36-
do { \
37-
if ((Pointer) (ptrsrc) != (Pointer) (ptrori)) \
35+
do \
36+
{ \
37+
if ((Pointer)(ptrsrc) != (Pointer)(ptrori)) \
3838
pfree(ptrsrc); \
3939
} while (0)
4040

@@ -51,7 +51,6 @@ typedef struct
5151
float xmin, xmax, ymin, ymax;
5252
} BOX2DF;
5353

54-
5554
/*********************************************************************************
5655
** GIDX support functions.
5756
**
@@ -61,7 +60,7 @@ typedef struct
6160
*/
6261

6362
/* allocate a new gidx object on the heap */
64-
GIDX* gidx_new(int ndims) ;
63+
GIDX *gidx_new(int ndims);
6564

6665
/* Increase the size of a GIDX */
6766
void gidx_expand(GIDX *a, float d);
@@ -70,7 +69,7 @@ void gidx_expand(GIDX *a, float d);
7069
bool gidx_is_unknown(const GIDX *a);
7170

7271
/* Generate human readable form for GIDX. */
73-
char* gidx_to_string(GIDX *a) ;
72+
char *gidx_to_string(GIDX *a);
7473

7574
/* typedef to correct array-bounds checking for casts to GIDX - do not
7675
use this ANYWHERE except in the casts below */
@@ -79,24 +78,24 @@ typedef float _gidx_float_array[sizeof(float) * 2 * 4];
7978
/* Returns number of dimensions for this GIDX */
8079
#define GIDX_NDIMS(gidx) ((VARSIZE((gidx)) - VARHDRSZ) / (2 * sizeof(float)))
8180
/* Minimum accessor. */
82-
#define GIDX_GET_MIN(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2*(dimension)]
81+
#define GIDX_GET_MIN(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2 * (dimension)]
8382
/* Maximum accessor. */
84-
#define GIDX_GET_MAX(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2*(dimension)+1]
83+
#define GIDX_GET_MAX(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2 * (dimension) + 1]
8584
/* Minimum setter. */
86-
#define GIDX_SET_MIN(gidx, dimension, value) ((gidx)->c[2*(dimension)] = (value))
85+
#define GIDX_SET_MIN(gidx, dimension, value) ((gidx)->c[2 * (dimension)] = (value))
8786
/* Maximum setter. */
88-
#define GIDX_SET_MAX(gidx, dimension, value) ((gidx)->c[2*(dimension)+1] = (value))
87+
#define GIDX_SET_MAX(gidx, dimension, value) ((gidx)->c[2 * (dimension) + 1] = (value))
8988
/* Returns the size required to store a GIDX of requested dimension */
90-
#define GIDX_SIZE(dimensions) (sizeof(int32) + 2*(dimensions)*sizeof(float))
89+
#define GIDX_SIZE(dimensions) (sizeof(int32) + 2 * (dimensions) * sizeof(float))
9190

9291
/* Allocate a copy of the box */
93-
BOX2DF* box2df_copy(BOX2DF *b);
92+
BOX2DF *box2df_copy(BOX2DF *b);
9493

9594
/* Grow the first argument to contain the second */
9695
void box2df_merge(BOX2DF *b_union, BOX2DF *b_new);
9796

9897
/* Allocate a copy of the box */
99-
GIDX* gidx_copy(GIDX *b);
98+
GIDX *gidx_copy(GIDX *b);
10099

101100
/* Grow the first argument to contain the second */
102101
void gidx_merge(GIDX **b_union, GIDX *b_new);
@@ -122,16 +121,14 @@ int gserialized_datum_get_gidx_p(Datum gserialized_datum, GIDX *gidx);
122121
/* Pull out the gidx bounding box from an already de-toasted geography */
123122
int gserialized_get_gidx_p(const GSERIALIZED *g, GIDX *gidx);
124123
/* Copy a new bounding box into an existing gserialized */
125-
GSERIALIZED* gserialized_set_gidx(GSERIALIZED *g, GIDX *gidx);
124+
GSERIALIZED *gserialized_set_gidx(GSERIALIZED *g, GIDX *gidx);
126125

127126
/* Given two datums, do they overlap? Computed very fast using embedded boxes. */
128127
/* int gserialized_datum_overlaps(Datum gs1, Datum gs2); */
129128
/* Remove the box from a disk serialization */
130-
GSERIALIZED* gserialized_drop_gidx(GSERIALIZED *g);
129+
GSERIALIZED *gserialized_drop_gidx(GSERIALIZED *g);
131130

132131
bool box2df_contains(const BOX2DF *a, const BOX2DF *b);
133-
134-
135132
void box2df_set_empty(BOX2DF *a);
136133
void box2df_set_finite(BOX2DF *a);
137134
void box2df_validate(BOX2DF *b);
@@ -146,7 +143,9 @@ bool box2df_below(const BOX2DF *a, const BOX2DF *b);
146143
bool box2df_above(const BOX2DF *a, const BOX2DF *b);
147144
bool box2df_overabove(const BOX2DF *a, const BOX2DF *b);
148145

149-
146+
void gidx_validate(GIDX *b);
147+
void gidx_set_unknown(GIDX *a);
148+
bool gidx_overlaps(GIDX *a, GIDX *b);
149+
bool gidx_equals(GIDX *a, GIDX *b);
150150
bool gidx_contains(GIDX *a, GIDX *b);
151151
int gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df);
152-

postgis/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ BRIN_OBJ= brin_2d.o brin_nd.o brin_common.o
6161
endif
6262

6363
ifeq (@HAVE_SPGIST@,yes)
64-
SPGIST_OBJ= gserialized_spgist_2d.o gserialized_spgist_3d.o
64+
SPGIST_OBJ= gserialized_spgist_2d.o gserialized_spgist_3d.o gserialized_spgist_nd.o
6565
endif
6666

6767
ifeq (@HAVE_PROTOBUF@,yes)

0 commit comments

Comments
 (0)