Latlong Data Type in SQL

Hi I have a question on what is the data type to use in MySql for LatLong

I am currently build an app with map feature that use lat long, but the problem when the data tried to sync to the database it returned error.

I use mysql not google sheet

I tried to use DECIMALS on the db setup but it returned error:
"Value ‘-6.188766, 106.758861’ in field ‘lat_long’ cannot be converted to type ‘Decimal’."

I also tried GEOMETRY and it also returned an error:
The insert/update operation attempted to write an invalid geometry value to a Geometry column.

Original error message from the database: Cannot get geometry object from data you send to the GEOMETRY field

Any feedback would appreciated.


Did you try a text type field - varchar in MySQL.

When in doubt always try a text field. Almost anything (not everything) can be converted to and from text.


Thanks alot it works!

1 Like

You are welcome!!