Le reste de la formation est réservé aux inscrits.
S'inscrire gratuitementCREATE EXTENSION postgis;
CREATE TABLE magasins (id SERIAL PRIMARY KEY, nom TEXT, geom GEOMETRY(Point, 4326));
INSERT INTO magasins (nom, geom) VALUES ('Paris Centre', ST_SetSRID(ST_MakePoint(2.3522, 48.8566), 4326));
-- Magasins dans un rayon de 5 km
SELECT nom FROM magasins WHERE ST_DWithin(geom::geography, ST_SetSRID(ST_MakePoint(2.35, 48.85),4326)::geography, 5000);