PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ make_strtree()

static struct STRTree make_strtree ( void **  geoms,
uint32_t  num_geoms,
char  is_lwgeom 
)
static

Make a GEOSSTRtree that stores a pointer to a variable containing the array index of the input geoms.

Definition at line 80 of file lwgeom_geos_cluster.c.

81{
82 struct STRTree tree;
83 tree.envelopes = 0;
84 tree.num_geoms = 0;
85 tree.geom_ids = 0;
86
87 tree.tree = GEOSSTRtree_create(STRTREE_NODE_CAPACITY);
88 if (tree.tree == NULL)
89 {
90 return tree;
91 }
92 tree.geom_ids = lwalloc(num_geoms * sizeof(uint32_t));
93 tree.num_geoms = num_geoms;
94
95 if (is_lwgeom)
96 {
97 uint32_t i;
98 tree.envelopes = lwalloc(num_geoms * sizeof(GEOSGeometry*));
99 for (i = 0; i < num_geoms; i++)
100 {
101 tree.geom_ids[i] = i;
102 tree.envelopes[i] = geos_envelope_surrogate(geoms[i]);
103 GEOSSTRtree_insert(tree.tree, tree.envelopes[i], &(tree.geom_ids[i]));
104 }
105 }
106 else
107 {
108 uint32_t i;
109 tree.envelopes = NULL;
110 for (i = 0; i < num_geoms; i++)
111 {
112 tree.geom_ids[i] = i;
113 GEOSSTRtree_insert(tree.tree, geoms[i], &(tree.geom_ids[i]));
114 }
115 }
116
117 return tree;
118}
void * lwalloc(size_t size)
Definition lwutil.c:227
static const int STRTREE_NODE_CAPACITY
static GEOSGeometry * geos_envelope_surrogate(const LWGEOM *g)
GEOSGeometry ** envelopes
uint32_t num_geoms
GEOSSTRtree * tree

References STRTree::envelopes, geos_envelope_surrogate(), lwalloc(), STRTree::num_geoms, STRTREE_NODE_CAPACITY, and STRTree::tree.

Referenced by union_dbscan_general(), union_dbscan_minpoints_1(), and union_intersecting_pairs().

Here is the call graph for this function:
Here is the caller graph for this function: