Joke Collection Website - Bulletin headlines - How to write and calculate the latitude and longitude distance of coordinates in sql statement? I am mysql database. Please be more specific! thank you
How to write and calculate the latitude and longitude distance of coordinates in sql statement? I am mysql database. Please be more specific! thank you
You can create a two-dimensional array in the system, store each coordinate as a two-dimensional array, and write a method to automatically calculate the distance between two coordinates when they are input.
For example, my coordinates are: 2, 3; Your coordinates are 4, 6.
Then define a method:
Public double get distance (double x1,double y 1, double x2, double y2){
Double a = math. ABS (x1-x2); //Absolute value
double b = math . ABS(y 1-y2); //Absolute value
Return to Math.hypot(a, b); //Returns the open root of the sum of squares.
}
- Previous article:The domineering slogan of company performance is fifty-six.
- Next article:What does Gobi Desert mean?
- Related articles
- Content sentences of epidemic prevention and control slogans and posters (collection of 80 sentences)
- Is teamwang a luxury?
- Class football slogan
- Summary of community legal publicity activities
- Selected slogans for civilized travel
- Shenzhen Enterprise Employee Locker Management Regulations
- What are the three winds in the construction of three winds?
- Enterprise color printing
- Do you think anti-corruption storm 4 looks good? How do you evaluate this film?
- Food company culture slogan classic