Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

data type of longitude and latitude to store in mysql database?

Tags:

php

mysql

I'm designing a table in mysql that will store a list of users and a Google Maps co-ordinate (longitude & latitude).

Will I need two fields, or can it be done with 1?

I don't know what I use? what I use float or decimal or GEOMETRY or there is new data type? what are the pros and cons of the best data type to choose it?

like image 725
Ahmed el-Gendy Avatar asked Dec 13 '12 11:12

Ahmed el-Gendy


1 Answers

You can use spatial extensions in mysql the datatype is POINT

It will be faster in search , and many features for geographic operation.

like image 52
assaqqaf Avatar answered Nov 11 '22 16:11

assaqqaf