MySQL Forums
Forum List  »  General

Re: Optimised way to search over 2 milllion poi data in mysql
Posted by: Rick James
Date: September 16, 2014 11:34PM

1. Yes, that is for converting degrees to radians ("_deg2rad") and also compensate for the *10000 when converting to MEDIUMINT.

2. @deg2dist -- Yes that is for converting degrees to miles or kilometers. Again the *10000 is already factored in.

If you don't use *10000 into MEDIUMINT, then these constants need changing.

3,4. @lon2lat -- Latitude lines are a constant distance apart (about 69 miles). Longitude lines are not. This factor is used in one place to adjust to make the "square" really close to being a square not a rectangle. At 60 degrees latitude (@my_lat), it takes 2 degrees of longitude to equal 69 miles. So, if the "square" is 1 degree of latitude (@dlat), it needs to be 2 degrees of longitude (@dlon). Only at the equator will @dlon = @dlat; that comes from @lon2lat = 1.0.

Part of the confusion here is that there are multiple ways of expressing the same "distance":
* Degrees of latitude (-90 to +90)
* Degrees of latitude scaled into a MEDIUMINT between (-900000 to +900000)
* Miles
* and the confusion over degrees of longitude.

Notice that I say "All computations done in Latitude degrees."

Options: ReplyQuote


Subject
Written By
Posted
Re: Optimised way to search over 2 milllion poi data in mysql
September 16, 2014 11:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.