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 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器