1

In the post Fastest Way to Find Distance Between Two Lat/Long Points, user Quassnoi provides the following code for calculating the distance between two locations:

    SELECT  *
    FROM    table
    WHERE   MBRContains
                    (
                    LineString
                            (
                            Point (
                                    @lon + 10 / ( 111.1 / COS(RADIANS(@lat))),
                                    @lat + 10 / 111.1
                                  ),
                            Point (
                                    @lon - 10 / ( 111.1 / COS(RADIANS(@lat))),
                                    @lat - 10 / 111.1
                                  ) 
                            ),
                    mypoint
                    )

In the comments sections, Quassnoi notes mypoint is the field in the table which stores the coordinates. My question is, when dealing with longitude and latitude, what is mypoint? What exactly do we need to pass to MBRContains as the second argument?

My apologies if this is a trivial question. I wanted to ask Quassnoi directly, but I don't have enough reputation points to comment on the post. Thanks in advance!

Greeen
  • 33
  • 4
  • Have you tried reading the MySQL documentation on [Spatial Analysis Functions](https://dev.mysql.com/doc/refman/5.7/en/spatial-analysis-functions.html)? – Barmar Dec 26 '17 at 20:49
  • I have not. It looks like a good read, though. Thanks! – Greeen Dec 27 '17 at 16:08

0 Answers0