Opened 12 years ago
Last modified 7 years ago
#2124 new enhancement
spatial index on topogeometries
Reported by: | robe | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS Fund Me |
Component: | topology | Version: | 2.0.x |
Keywords: | Cc: |
Description
One of the main stopping points of topogeometries preventing them from replacing geometries in cases they should is the lack of a spatial index.
The main issue unless I am mistaken is unlike a geometry, you can't just apply a bounding box index on a topogeometry since the geometry itself is not dependent on change of topogeometry.
However since we do have a relations table that defines what layer, and primitive elements a topogeom belongs to (contains), it seems to me we should be able to write a trigger against the
faces,edges, nodes tables that then triggers a rebuild of bbox of dependent topogeoms. In theory we don't need to store the bbox anywhere since it's stored in the index, we just need to institute a dummy update on the topogeom record to force it to rebuild the spatial index record. Something as stupid as (in pseudo code syntax) cause I can't remember the exact functions
UPDATE table.topo = table.topo WHERE Contains(topo, element_changed);
Where the sql statement would be dynamically generated and table.topo would be replaced with layers that contain element that has changed. The trigger would be an after trigger on relations, faces, edges, nodes.
oops one big gotcha. I guess we would need to store the bbox somewhere since the topology.geometry CAST operator is volatile and therefore can't be used in an index.