Warning: Missing argument 2 for wp_kses(), called in /var/www/wphost/wp-content/plugins/bsocial/components/open-graph.php on line 175 and defined in /var/www/wphost/wp-includes/kses.php on line 476
MySQL has some powerful, and perhaps underused spatial extensions, but the most interesting functions are still unimplemented: “Note: Currently, MySQL does not implement these functions…”
Among those as-yet unimplemented functions is DISTANCE(). Alternatives can be found here and here, though neither is clean or simple. I wonder if a simple MBRContains() is good enough, though…
Posted on Tuesday, June 10th, 2008 at 9:15 pm in Technology | RSS feed
There’s an example of distance calculation in the mysql manual – the trick is to make a line out of the two points and then get the length of the line:
Thanks for your work – saved me a bit of digging!
It should be noted that that GLength is only acurate when the coordinate system is a flat grid projection. The links provided in the orignal post are for calculating geodesic distance (Non Euclidean) which is needed if your geometry is defined by lon/lat.
regarding the issue with the flat grid i agree. However, does anyone know for which distances this effect is noteable? e.g. if i want to get all locations within 50 miles, does it really make a big difference?