I want to generate a polygon as a circle with a 10-kilometre radius around a defined point in MySQL (no PHP or other programming languages). The point is provided as a geographical coordinate with longitude-latitude, e.g. "100.8160803 13.7538929" for the city of Bangkok, the SRID is 4326.
The polygon does not have to be a perfectly rounded circle, a hexagon or octagon would be fine, too.
Tried to use ST_Buffer but this does not work because it can't handle SRIDs (apart from SRID 0, of course).
I found many tutorials/queries on how to locate points in a certain radius around a point, like here: MySQL - Find points within radius from database
And here is the code for such a query:
SELECT id,
( 6371 *
ACOS(
COS( RADIANS( db_latitude ) ) *
COS( RADIANS( $user_latitude ) ) *
COS( RADIANS( $user_longitude ) -
RADIANS( db_longitude ) ) +
SIN( RADIANS( db_latitude ) ) *
SIN( RADIANS( $user_latitude) )
)
)
AS distance FROM the_table HAVING distance <= $the_radius ORDER BY distance ASC"
But I still don't know how to generate a circular polygon around a point.