dongsi7759 2011-02-24 06:23 采纳率: 100%
浏览 293
已采纳

Mysql如何检索多边形数据?

我一直在开发一个站点,在MySQL数据库中存储空间数据,比如建筑物、花园等的多边形(纬度和经度)。

我想知道如何在MySQL中检索多边形数据。

我看到了这个链接中也提到了插入多边形数据:http://amper.110mb.com/SPAT/mysql_initgeometry2.htm

但是现在我想知道如何根据某些约束从表中检索数据,例如:

"where latitude < 9.33 and longitude > 22.4" 此外,如何找出一个点是在多边形的内部还是外部?

  • 写回答

1条回答 默认 最新

  • dtv7174 2011-02-24 06:43
    关注

    Here is a page with lots of examples: http://howto-use-mysql-spatial-ext.blogspot.com/

    This is one of the examples to retrieve rows which points intersect with a specified bounding box:

    SET @bbox = 'POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'; 
    SELECT name, AsText(location) FROM Points
        WHERE Intersects( location, GeomFromText(@bbox) );
    

    The MySQL documentation says these spatial functions also work with geometries (Looks like a Point is also a Geometry). So you can check if the geometry in the database intersects with the one you specify in the select statement.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog