I've seen many posts regarding this issue, but most point to a bug in MySQL 5.0, resolved in 5.1. This may be true, although I'm running 5.1 find that AsText returns a BLOB. When I had this issue with group_concat, I found it was related to a mysql directive in my.conf, called group_concat_max_len, but I couldn't find any related directive for this issue.

My resolve was to simply cast the result as a CHAR.

Select Cast( AsText( Envelope( the_polygon ) ) AS char ) as the_polygon

Result:

POLYGON((0 0,200 0,200 200,0 200,0 0))

 

This may be a little off topic, but I'm assuming that most folks using AsText are interested in MySQL's spatial extensions. I have yet to find a built-in function to return a given point in a Polygon. While pointN() will work for LineString, there doesn't seem to be a Polygon equivalent.

Using a pseudo-code example, I suppose the best method for doing these would be in your scripting language:

the_polygon.split('POLYGON((')[1].replace('))').split(',')[the_point_number]

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *