Find the neighbourhoods no supermarket serves

Grocery expansion teams look for homes with no store within reach. This example finds every residential building in Lisbon more than 1 km from a supermarket, from OpenStreetMap.

Lisbon homes more than 1 km from a supermarket

Data: OpenStreetMap supermarkets, mapped as points or outlines, and residential buildings
Method: keep residential buildings with no supermarket within 1 km, measured on the ellipsoid

-- Residential buildings with no supermarket within 1 km
WITH supermarkets AS (
  SELECT geom FROM osm.shop_point
  WHERE  osm_type = 'shop' AND osm_subtype = 'supermarket'
    AND  geom && ST_MakeEnvelope(-9.28, 38.66, -9.05, 38.82, 4326)
  UNION ALL
  SELECT ST_Centroid(geom) FROM osm.shop_polygon
  WHERE  osm_type = 'shop' AND osm_subtype = 'supermarket'
    AND  geom && ST_MakeEnvelope(-9.28, 38.66, -9.05, 38.82, 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(-9.25, 38.68, -9.08, 38.80, 4326)
  AND  NOT EXISTS (
         SELECT 1 FROM supermarkets AS s
         WHERE  s.geom && ST_Expand(b.geom, 0.013)
           AND  ST_DWithin(b.geom::geography, s.geom::geography, 1000)
       );
Run preview Save query Save as Layer ⌘/Ctrl-Enter · read-only · ≤100 rows · 30s cap

The supermarket search runs a little wider than the homes, so a shop just over the city edge still counts.

130 residential buildings more than 1 km from a supermarket · updated Oct 20, 2026 Open the map ↗ Sources and method

Run it on your data

Upload your own stores, or your competitors', as a spreadsheet and swap them in for the supermarkets step to see which homes none of them reach. Change 1000 to test another distance. See spreadsheets.

Frequently asked questions

Does a gap mean a good site?

Not by itself. Distance is one input. Demand needs data this example does not include.

Is the 1 km measured along streets?

No, in a straight line. Distance along streets needs a road network and a different method.

Next step