MySQL Great Circle intersection (two roads intersect?)

MySQL OpenGIS CROSSES doesn't seem to work for me:

SET @ls = 'LineString(1 1, 2 2, 3 3)';
SET @xx = 'LineString(0 2, 10 2)';

# SELECT AsText(EndPoint(GeomFromText(@ls)));
select crosses(GeomFromText(@ls), GeomFromText(@xx))

      

returns 0 - expected 1

How can I rewrite this as a MySQL function?

Bonus points for the use of lat, bosom and spherical projection (and possibly the Great Circle).

PS I can't create tags and I lost my old login: Useful tags would be: MySQL OpenGIS CROSSES greatcircle lat lon - :)

0


source to share


2 answers


OK, in the end I just implemented this: http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/



0


source


Just use INTERSECTS (line1, line2)



SET @ls = 'LineString(1 0,1 2)';
SET @xx = 'LineString(0 1, 2 1)';
select INTERSECTS(GeomFromText(@ls), GeomFromText(@xx));

      

+1


source







All Articles