Calculating Distance Between Points In MySQL
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…
1 Comment(s)
Comments RSS TrackBack Identifier URI
Leave a comment
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:
ROUND(GLength(LineStringFromWKB(LineString(AsBinary(point1), AsBinary(point2)))))
http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html
Thanks for your work – saved me a bit of digging!