--- path: industries/transportation title: Transportation desc: Find the homes more than 400 m from a bus stop. date: Oct 21, 2026 --- # Find the homes public transport doesn't reach Transport planners measure how many homes sit beyond easy reach of a stop. This example finds every residential building in Singapore more than 400 m in a straight line from a bus stop, from OpenStreetMap. ## Singapore homes more than 400 m from a bus stop **Data:** OpenStreetMap bus stops and residential buildings **Method:** keep residential buildings with no bus stop within 400 m, measured on the ellipsoid ```sql -- Residential buildings with no bus stop within 400 m WITH stops AS ( SELECT geom FROM osm.public_transport_point WHERE osm_type = 'bus' AND geom && ST_MakeEnvelope(103.58, 1.20, 104.07, 1.49, 4326) ) SELECT b.osm_id, b.osm_subtype AS building, b.geom FROM osm.building_polygon AS b WHERE b.osm_type = 'building' AND b.osm_subtype IN ('apartments', 'residential', 'house', 'semidetached_house', 'terrace', 'detached', 'dormitory') AND b.geom && ST_MakeEnvelope(103.6, 1.22, 104.05, 1.47, 4326) AND NOT EXISTS ( SELECT 1 FROM stops AS s WHERE s.geom && ST_Expand(b.geom, 0.005) AND ST_DWithin(b.geom::geography, s.geom::geography, 400) ); ``` ```map singapore-homes-far-from-bus-stops ``` ## Run it on your data Upload your own stops, or the stops of a planned route, as a file or spreadsheet and swap them in for the `stops` step to see which homes they leave out. Change `400` to test another distance. See [supported files](/docs/upload-anything/files). ## Frequently asked questions **Is 400 m a walking distance?** No\. It is straight\-line\. Walking routes need a road network and a different method\. **Why count buildings rather than people?** OpenStreetMap maps buildings, not residents\. The count shows where the gaps are, not how many people they affect\. ## Next step - [Open the map in the gallery](/gallery?industry=transportation) - [Upload your stops](/docs/upload-anything/files) - [Learn the SQL behind it](/docs/spatial-sql-book) - [Book a demo](/demo)