MySQL Forums
Forum List  »  GIS

Syntax error when using geometry functions
Posted by: Cpt Nautilus
Date: May 13, 2009 02:44AM

Hello,
I just discovered MySQL spatial extensions and I am trying to put them to good use. However, I am stumbling on a very strange problem:

I create a test table with a geometry column for polygons. I create a polygon inside a user-defined variable and insert it into the table. So far, everything works properly. When I browse the table, I can see the binary code showing the polygon I have just created.

The problem arises when I try to use a function on this polygon. I have tried AsText and Area (and also X() and Y() on a POINT field) and in each case, the function works properly when applied to the variable, but fails with a syntax error (#1064) when used on the table.

Here is a code allowing to reproducing the error:

CREATE TABLE Pol (Poly POLYGON);
SET @p:=PolygonFromText('POLYGON((60.000418 -31.999583,60.000418 67.999584,-2.000417 67.999584,-2.000417 -31.999583, 60.000418 -31.999583))');
INSERT INTO Pol VALUES(@p);

SELECT Area(@p); # This produces correct results
SELECT Area(Poly) FROM `Pol`; # This produces a Syntax error #1064

I am using MySQL - 4.1.22

Where am I doing a mistake????

Options: ReplyQuote


Subject
Views
Written By
Posted
Syntax error when using geometry functions
4700
May 13, 2009 02:44AM


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.