I used the tutorial from http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html so I created two tables, inserted some data, and when I tried to get some data using a script
SELECT c.cab_driver, ROUND(GLength(LineStringFromWKB(LineString(AsBinary(c.cab_loc), AsBinary(a.address_loc))))) AS distance FROM cab c, address a WHERE a.address = 'Foobar street 110' ORDER BY distance ASC LIMIT 1;
I got an error: "Error code: 1367 Invalid non-geometric value aswkb ( c . cab_loc )" found during parsing "
Any suggestions?
I have some progress on this issue, I tried to run
SELECT asbinary(c.cab_loc) FROM usercoordinates.cab c;
and I get NULL in each line, but if I use astext, I get POINT (...) in each line
Finally, I realized, maybe this is not the best solution, but
SELECT c.cab_driver, Round(glength(LineStringFromWKB(LineString(GeomFromText(astext(c.cab_loc)),GeomFromText(astext(a.address_loc)))))) AS distance FROM cab c, address a WHERE a.address = 'Foobar street 99' ORDER BY distance ASC LIMIT 1;
source share