如何将 MySQL 空间数据类型与多边形的链接数据结合使用?
我将有一个包含很多点的表(声明为 POINT)。现在我想用一些多边形和类似的东西创建另一个表。多边形应链接到第一个表的点;如果我更改第一个表中的一个点,第二个表中的多边形应该自动更新 - 它们应该被链接。
这可能吗?或者我应该为自己复制数据并创建冗余?
I will have a table with a lot of points (declared as POINT). Now I want to create another table with some polygons and similar. The polygons should be linked to the points of the first table; if I change one point in the first table, the polygons in the second table should updated automatically - they should be linked.
Is this possible? Or should I copy the data for myself and create the redundancy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为点创建主键,并从多边形表中引用该列(外键引用)。当您查询多边形时,您将连接两个表。
编辑
以前的解决方案是错误的,如果您从点表中引用多边形 id,则它是正确的:
Create a primary key for the points, and reference this column from the polygon table (foreign key reference). When you query the polygons you join the two tables.
EDIT
Previous solution is wrong, it's correct if you reference polygon id from points table like this: