在PHP中将MYSQL多边形转换为文本 [英] Converting MYSQL Polygon to text in PHP
问题描述
我发现了这个问题&回答,它解决了我的问题. 但是我还没有找到多边形的解决方案.
I found this question & answer and it solved my problems. But I haven't found a solution for polygons.
有人可以将点/多边形转换为类似于示例的文本吗?
Does someone have a solution to convert the blob/polygon to text similar to the point example?
推荐答案
If you use ST_NumGeometries(from https://dev.mysql.com/doc/refman/5.7/en/gis-geometrycollection-property-functions.html#function_st-numgeometries) it should give you the number of points and then you could to use a loop and ST_GeometryN to fetch each individual point. This would still need to be decoded like you already have.
您可以将多边形转换回文本(AsText),然后在那里解析数据.
You could convert the polygon back to text (AsText) and then parse the data there.
这篇关于在PHP中将MYSQL多边形转换为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!