What is the best way to store a latitude, longitude location in mysql?
I am wondering if it is better (faster, easier to manage!!!!, etc.) to store it as point such as GeomFromText('POINT(latitude longitude)') or to simply make two columns?
Also, if it is stored as a point, how would it be retrieved from the db? X(AsText(locati开发者_开发技巧on)) and Y(AsText(location)) dont seem to be working for me.
Look at the problem the other way around and you will have your answer.
First think about how you would want to retrieve it, and what kind of queries you want to be able to do on that data. Then use the column format that's easiest for you to do that.
If want to retrieve latitude and longitude separately, use two columns.
I always use 2 columns Lat and Lng in my projects.
精彩评论