0

I have specific problem with MySQL ST_intersect function. MySQL ST_intersect doesn't work correctly in our case.

I'm asking for intersects between polygon and line like in example bellow:

SELECT  ST_intersects( GeomFromText( 'POLYGON((0 10,10 10,10 0,0 0.1,0 10))'), GeomFromText( 'LINESTRING(5 2, 11 -4)' )  )

This will return true but (after change on 4th point in polygon):

SELECT  ST_intersects( GeomFromText( 'POLYGON((0 10,10 10,10 0,0 0,0 10))'), GeomFromText( 'LINESTRING(5 2, 11 -4)' )  )

This will return false.

How is it possible in this very simple geometry?

Because when I'm asking if the same line intersects polygon like this: 0 0,10 0,10 -10,0 -10,0 0 everything is correct and result is true.

Thanks for any ideas.

  • What version of MySQL are you using? if it is before 5.6.1, then these methods are still approximating (e.g., same as MBR methods): MySQL originally implemented these functions such that they used object bounding rectangles and returned the same result as the corresponding MBR-based functions. As of MySQL 5.6.1, corresponding versions are available that use precise object shapes. These versions are named with an ST_ prefix. For example, Contains() uses object bounding rectangles, whereas ST_Contains() uses object shapes. – Andrew - OpenGeoCode Mar 07 '14 at 19:05
  • I'm using version 5.6.13 and results of methods with ST_ and without ST_ are different. It seems like these methods work different (as it schould). This is something that I can not understand. Do you think I have to try a newer version of MySQL? – Martin Kotyk Mar 10 '14 at 16:39
  • I read in the release notes for 5.6.14 they implemented aliasing these functions (ie., with and without ST_ should be the same). I've played it safe and use the ST_ version. – Andrew - OpenGeoCode Mar 10 '14 at 16:59

0 Answers0