mySql的缓冲区分析



SET @point = 'POINT(-126 45)';
SET @radius = 245;


SET @bbox = CONCAT('POLYGON((',
X(@center) - @radius, ' ', Y(@center) - @radius, ',',
X(@center) + @radius, ' ', Y(@center) - @radius, ',',
X(@center) + @radius, ' ', Y(@center) + @radius, ',',
X(@center) - @radius, ' ', Y(@center) + @radius, ',',
X(@center) - @radius, ' ', Y(@center) - @radius, '))'
);


SELECT  AsText(pnt)
FROM pnttest
WHERE Intersects(pnt, GeomFromText(@bbox) )
AND SQRT(POW( ABS( X(pnt) - X(@center)), 2) + POW( ABS(Y(pnt) - Y(@center)), 2 )) < @radius;

你可能感兴趣的:(mySql的缓冲区分析)