Instruction
Perfect! Another interesting function that returns a geometry is ST_Buffer(geometry, distance). According to the PostGIS documentation, this function returns a geometry that represents all points whose distance from this geometry is less than or equal to 'distance'. Sounds complicated? It's actually quite simple! Take a look:
In simple terms, ST_buffer creates a bounded region called a "buffer around a given geometry, where all points on the edges of the buffer are guaranteed to be 'distance' away from a given geometry. Take a look:
SELECT
ST_Buffer(ST_Transform(
coordinates,26910),50)
FROM sf_atms;
The query above returns a buffer of 50 meters around each ATM in San Francisco.
Exercise
For the hotel with id = 1, show its name, its area in meters squared, and the area of the piece of land it occupies, which is a buffer of distance 20 meters around the hotel.
Stuck? Here's a hint!
Use the ST_Area function. Inside its parentheses, use ST_Buffer. Remember to use ST_Transform(...,26910) to get the correct units.



