liveBook · Manning

ST_Expand

As explained in Just Use Postgres!

ST_Expand is a PostGIS function that expands a geometry's bounding box by a specified distance.

ST_Expand enlarges a geometry’s bounding box by a specified distance. In spatial searches, it supplies a fast candidate filter through the && bounding-box operator, while ST_DWithin performs the accurate distance check. section 10.6.2

Finding nearby shops

A query finds shops within 500 meters of the Brickell City Centre station. The GiST index uses && with st_expand(way, '500') to narrow candidates; ST_DWithin then verifies actual distance before sorting the nearest ten results. section 10.6.2

How Just Use Postgres! covers it

How deep it goes
Explains bounding-box prefiltering and its execution role, but stops short of detailed function syntax or edge cases.
Examples
Demonstrates a Brickell City Centre query that filters nearby shops and returns ten distances.
What it assumes
Assumes familiarity with PostGIS geometries, SQL joins, spatial predicates, and GiST indexes.
What you can do after
Apply it via PostGIS to understand and accelerate bounding-box filtering in nearby-feature queries.
How it connects
Connects ST_Expand with GiST indexes, bounding-box operators, ST_DWithin, and ST_Distance.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.