MySQL Forums
Forum List  »  GIS

Re: Creating a polygon from existing decimal data
Posted by: Dan Tappin
Date: May 02, 2010 11:59AM

After some more digging I came up with:

UPDATE `grid` SET poly = PolygonFromText(CONCAT('POLYGON(',n,' ',e,', ',s,'
',e,', ',s,' ',w,', ',n,' ',w,', ',n,' ',e,')'));

I had my delimiters mixed up and I know my CONCAT worked:

mysql> select CONCAT('POLYGON(',n,' ',e,', ',s,' ',e,', ',s,' ',w,', ',n,'
',w,', ',n,' ',e,')') from grid limit 3;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| CONCAT('POLYGON(',n,' ',e,', ',s,' ',e,', ',s,' ',w,', ',n,' ',w,', ',n,'
',e,')') |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| POLYGON(49.07756615 101.36211395, 49.07390213 101.36211395, 49.07390213
101.36764145, 49.07756615 101.36764145, 49.07756615 101.36211395) |
| POLYGON(49.08123016 101.36211395, 49.07756615 101.36211395, 49.07756615
101.36764145, 49.08123016 101.36764145, 49.08123016 101.36211395) |
| POLYGON(49.08489418 101.36211395, 49.08123016 101.36211395, 49.08123016
101.36764145, 49.08489418 101.36764145, 49.08489418 101.36211395) |
+-------------------------------------------------------------------------------------------------------------------------------------------+

But after my UPDATE my poly column is still full of NULL values.

I am sure I am missing something simple here.

Dan

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Creating a polygon from existing decimal data
3028
May 02, 2010 11:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.