This PR is meant to speed up the spatial querying that we use for our radius distance filter, where a user creates a point on the map and projects are filtered for a distance from that point.
changed radiusDistanceQuery to use ST_DWithin which queries for all geometries within a distance from a point, this query receives a distance_from_point value (the coordinates) and a radius_from_point value (the distance) from the frontend, then filtering is performed in the backend
Also part of this PR was adding indexes on both the centroid and polygons geometry columns in table project_geoms
Indexes were created with:
CREATE INDEX centroid_index ON project_geoms USING gist(centroid);CREATE INDEX polygons_index ON project_geoms USING gist(polygons);
This PR is meant to speed up the spatial querying that we use for our radius distance filter, where a user creates a point on the map and projects are filtered for a distance from that point.
radiusDistanceQuery
to useST_DWithin
which queries for all geometries within a distance from a point, this query receives adistance_from_point
value (the coordinates) and aradius_from_point
value (the distance) from the frontend, then filtering is performed in the backendcentroid
andpolygons
geometry columns in tableproject_geoms
Indexes were created with:
CREATE INDEX centroid_index ON project_geoms USING gist(centroid);
CREATE INDEX polygons_index ON project_geoms USING gist(polygons);
Closes #474