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 June 10, 2008 by Casey Bisson
Categories: Technology. Tags: distance, geolocation, mysql, MySQL spatial functions, spatial functions, unimplemented, workaround.
1 Comment(s)
Comments RSS
TrackBack Identifier URI
User contributed tags for this post:
mysql distance (221) - mysql spatial distance (136) - mysql distance function (120) - mysql geo distance (111) - mysql distance between points (80) - distance between points (65) - Mysql geo (63) - distance mysql (54) - mysql point distance (48) - MySQL Calculate distance (42) - Geo Distance Search with mySQL (41) - mysql distance between two points (35) - mysql gis distance (34) - distance between coordinates (33) - mysql geo functions (32) - calculating distance (29) - What is the distance between the two points, (8,2) and (2,10)? (29) - mysql coordinates (26) - mysql distance point (23) - mysql distance between 2 points (22) - mysql distance calculation (22) - distance between two points mysql (21) - mysql geo search (20) - geo distance mysql (19) - mysql distance coordinates (18) - calculate distance between coordinates (18) - calculate distance mysql (16) - distance between two geo points (14) - mySQL BETWEEN (12) - calculate distance between coordinates mysql (12) - php distance between coordinates (12) - calculating distances (11) - mysql DISTANCE() (11) - mysql spatial distance between points (11) - MySQL Spatial Distance Function (11) - spatial distance mysql (11) - mysql distance two points (11) - mysql function distance (11) - distance search mysql (10) - mysql distance example (10) - distance spatial mysql (10) - coordinates mysql (10) - mileage between points (9) - mysql distance search (9) - mysql distance between coordinates (9) - distance() mysql (9) - point distance mysql (9) - distance between coordinates mysql (9) - geo mysql (9) - mysql geolocation distance (9) - mysql (8) - BETWEEN mysql (8) - distance between coordinate points (8) - mysql geo distance search (8) - mysql distance spatial (8) - geo distance php (8) - mysql between example (8) - mysql earth distance (8) - mysql calculate distance between two points (8) - mysql calculate distance spatial (8) - mysql geodistance (8) - mysql distance coordinate (8) - between in Mysql (7) - mysql calculate fields (7) - calculating distance between coordinates (7) - php geo distance (7) - calculating distances between places (7) - point mysql (7) - Calculating Distance in GIS (7) - calculate distance geolocation (7) - mysql geo distance function (7) - calculating distance mysql (7) - mysql calculate distance between coordinates (7) - php calculate distance (7) - mysql coordinate distance (7) - mysql distance geo (7) - mysql distance between two coordinates (7) - distance between 3 points (7) - calculate distance in MySQL (7) - mysql geo coordinates (7) - MySQL GIS (6) - distances between points (6) - calculate distances (6) - mysql calculate distance between points (6) - between function in mysql (6) - calculating coordinate points (6) - mysql distance points (6) - mysql get distance (6) - MySQL between function (6) - Distance function for MySQL (6) - distance mysql gis (6) - distance in mysql (6) - distance between points php (6) - distance between points mysql (6) - distance between two coordinates mysql (6) - mysql gis functions (6) - mysql spatial calculating distance in miles (6) - mysql spatial calculate distance (5) - mysql distance() gis (5) - mysql GIS calculate distance (5) - php mysql calculate distance (5) - distance between.in (5) - mysql function calculate distance (5) - mysql distance calculation google maps (5) - mysql calculating distance (5) - calculate distance between coordinates php (5) - mysql calculate distance coordinates (5) - distance between three points (5) - google maps Distance between Points (5) - maps.example.com/distance (5) - geolocation distance (5) - geodistance with mysql (5) - geolocation distance calculation (5) - Geo-Distance-Search-with-MySQL (5) - What is the distance between the points (4, 7) and (4, 5)? (5) - mileage distance between two points (5) - calculate distance between two points mySQL (5) - calculate distance between geo points (5) - Finding distance between two points mysql (5) - mysql spatial data calculating distance between two point (5) - google maps mysql distance (5) - calculate mysql (4) - mysql spatial distance example (4) - mysql geolocation (4) - mysql calculate distance between two point (4) - calculating with mysql (4) - calculate distance google earth (4) - mysql calculate (4) - distance geopoints (4) - calculating mileage distance (4) - google save distance mysql (4) - google maps mysql gis (4) - mysql distance function example (4) - function distance mysql (4) - mysql points distance (4) - google maps distance mysql (4) - calculating the distance between two cell phone text message (4) - www.com.geo tv (4) - mysql coordinates distance (4) - mysql gis POINT (4) - mysql function distance between coordinates (4) - calculating distance in mysql (4) - calculate distance between points (4) - mysql distance from (4) - mysql gis google maps (4) - mysql geosearch (4) - calculating in mysql (4) - google maps calculate distance (4) -
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!