I have a table called "gebaeude" with all types of buildings in the city. In the following I want to use a Buffer around the central train station that has the id="2" and a radius of 1000m. Then I want to select the building types "kinergarten" and "school" that are within this radius by intersecting them with the buffer. What I did looks like this:
WITH center AS (
SELECT ST_Buffer(geom, 1000) FROM gebaeude
WHERE id='2')
SELECT gebaeude.name AS "Name",
ST_Distance(center.geom, gebaeude) AS Distanz
FROM gebaeude, center
WHERE (gebaeude='school' OR gebaeude.type='kindergarten')
AND ST_Intersects(gebaeude.geom,center.geom);
I get the following error:
ERROR: column center.geom does not exist LINE 5: ST_Distance(center.geom, gebaeude) AS Distanz ^
What am I doing wrong?
ST_DWithin
on one of your older posts, and that is the optimal solution!