如何使用MySQL Spatial Extensions创建半径和中心坐标为圆的Geometry? [英] how do i create a circle Geometry with a radius and co-ordinates of center, using MySQL Spatial Extensions?
问题描述
我正在尝试使用中心和半径的坐标在 MySQL 中创建圆几何.我到处搜索...在该站点的MySQL文档中我所能找到的都是多边形.可能是我在错误的地方寻找.任何人都可以通过适当的SQL来帮助我,该SQL可以帮助我创建一个将此Circle几何存储为表格中的列之一的表格吗? 另外,我什至不确定在MySQL中是否有办法?我使用的版本是 MySQL 5.6.
I am trying to create a Circle Geometry in MySQL using the co-ordinates of the center and a radius. I searched everywhere...all i could find in the MySQL doc on the site were for polygons. May be i am looking in the wrong place. can anybody help me with an appropriate SQL that can help me create a table that stores this Circle geometry as one of the columns in the table? Also, i am not even sure if there is a way to do so in MySQL?..The version i am using is MySQL 5.6.
谢谢.
推荐答案
As of MySQL v5.6.1, you can use Buffer(g, d)
:
返回一个几何图形,该几何图形表示与几何值
g
的距离小于或等于d
的距离的所有点.
Returns a geometry that represents all points whose distance from the geometry value
g
is less than or equal to a distance ofd
.
很明显,在您的情况下, g
应该是圆心,而 d
应该是圆半径.
Obviously, in your case g
should be the point at the centre of the circle and d
should be its radius.
这篇关于如何使用MySQL Spatial Extensions创建半径和中心坐标为圆的Geometry?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!