0

My table uses a SqlGeometery in SRID 3857.

Given a point, how would I find all shapes within a X miles or meters radius?

Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447

1 Answers1

1

Put a Buffer around the point and run STIntersects to get all intersection shapes. Just make sure you put an index on the Geometry column otherwise it could get slow. Note that x is in meters (eg 10m).

SELECT *
FROM MyTable
WHERE MyGeometryShapesColumn.STIntersects(@MyGeometryPoint.STBuffer(10)) = 1;
g2server
  • 5,037
  • 3
  • 29
  • 40