I have a set of WGS84 coordinates. The conservative approach is to store them as number ( What datatype to use when storing latitude and longitude data in SQL databases? ) and calculate distances as here ( latitude/longitude find nearest latitude/longitude - complex sql or complex calculation).
A little more advanced approach is to create a user defined function for "in range" ( MySQL User Defined Function for Latitude Longitude Syntax )
MySQL latitude and Longitude table setup uses a spatial index . But I do not quite get if it is possible to directly store WGS coordinates, and then query a distance based on the Point
data type?
Example: Data look like this: "lat" 40.7142298
, "lng" -73.9614669
, and this is what I'd like to import. Then query like "select all tupel within 10km of lat / lng".
POINT(40.7 -73.9)
? Or is it that you want to avoid the (string) conversion when importing your data? – RandomSeedPOINT()
datatype is decimal, so "40.5" must not mean anything else but "forty and a half". – RandomSeed