George Mann
George Mann

Reputation: 115

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(location)) and Y(AsText(location)) dont seem to be working for me.

Upvotes: 1

Views: 1771

Answers (2)

Mat
Mat

Reputation: 206889

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.

Upvotes: 1

ysrb
ysrb

Reputation: 6740

I always use 2 columns Lat and Lng in my projects.

Upvotes: 0

Related Questions