How to correctly set the value of a "point" field into a MySql database table?

480 Views Asked by At

I am pretty new in database and I working on a MySql database.

Into a table I have a field named geographical_position having POINT as data type. This field represent the GPS position of a point on a map.

I tryied to insert a value as 41.729086, 12.278478 for a record of this table form my IDE but it was not initialized (it appear null)

Now trying to update it by the IDE (setting it "as text) butI obtain the following error message:

#22003Cannot get geometry object from data you send to the GEOMETRY field

What is the correct way to insert the coordinates of this point into this POINT field?

1

There are 1 best solutions below

0
On

Check the manual:

 INSERT INTO geom VALUES (ST_GeomFromText('POINT(41.729086 12.278478)'));