Slow version (no spatial indexes):
SELECT * FROM mytable WHERE MBRIntersects(mypolygon, LineString(Point(@X - @distance, @Y - @distance), Point(@X + @distance, @Y + @distance))
To use spatial indexes, you need to denormalize the table so that each vertex of the polygon is stored in its own record.
Then create a SPATIAL INDEX in a field that contains the coordinates of the vertices, and just run this query:
SELECT DISTINCT polygon_id FROM vertices WHERE MBRContains(vertex, LineString(Point(@X - @distance, @Y - @distance), Point(@X + @distance, @Y + @distance))
Everything will be much simpler if you save the UTM coordinates in your database, rather than latitude and longitude.
Quassnoi
source share