在PHP中将MYSQL多边形转换为文本 [英] Converting MYSQL Polygon to text in PHP

查看:86
本文介绍了在PHP中将MYSQL多边形转换为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将MySQL的POINT转换为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?

推荐答案

如果您使用ST_NumGeometries(来自

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆