Datatype to Store Longitude/Latitude in Mysql

Mar 12, 2012   //   by phpfreelancer.biz   //   Blog, MySQL Tutorial  //  No Comments

I’m currently using the datatype spatial: geometry.

Its returns the errors like this:

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

You can use POINT() to store into a column of type GEOMETRY or POINT:

POINT(43.005895, -71.013202)

If the Geometry column is named geom, you can use this:

INSERT INTO table
    ( ..., geom, ...) 
  VALUES
    ( ..., POINT(43.005895, -71.013202), ...)

Leave a comment

Share This Post

RSS Wordpress News