开发者

MySQL Great Circle intersection (do two roads cross?)

MySQL OpenGIS CROSSES doesn't seem to w开发者_Python百科ork 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 would I rewrite this as a MySQL function?

Bonus points for using lat, lon and spherical projection (and maybe the Great Circle.)

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


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));


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜