简体   繁体   English

如何在MySQL中将点添加到多边形或几何的所有点?

[英]How to add point to all points of a polygon or geometry in mysql?

I have a polygon @poly and a point @p as: 我有一个多边形@poly和一个点@p作为:

SET @poly = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
SET @p = ST_GeomFromText('Point(1 2)');

I want to add @p into @poly to get a new polygon as: 我想将@p添加到@poly中以得到一个新的多边形:

Polygon((1 2,1 5,4 5,4 2,1 2))

But I couldn't find a solution for this. 但是我找不到解决方案。

I'm using MySQL 5.7 我正在使用MySQL 5.7

One option is you can try to create a new collection and add polygon and point together. 一种选择是,您可以尝试创建新的集合并添加多边形并指向一起。

Another one - Use WKB/WKT and parse the points @poly and append @p. 另一个-使用WKB / WKT解析点@poly并附加@p。

You can read more info here : https://postgis.net/docs/using_postgis_dbmanagement.html#OpenGISWKBWKT 您可以在这里阅读更多信息: https : //postgis.net/docs/using_postgis_dbmanagement.html#OpenGISWKBWKT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM