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".
Have you read the Manual section on the Spatial Extensions?
To query, define a query region (e.g. rectangle) and then filter by
within