久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='YqeJd'></bdo><ul id='YqeJd'></ul>

      <legend id='YqeJd'><style id='YqeJd'><dir id='YqeJd'><q id='YqeJd'></q></dir></style></legend>

    1. <small id='YqeJd'></small><noframes id='YqeJd'>

    2. <tfoot id='YqeJd'></tfoot>

        <i id='YqeJd'><tr id='YqeJd'><dt id='YqeJd'><q id='YqeJd'><span id='YqeJd'><b id='YqeJd'><form id='YqeJd'><ins id='YqeJd'></ins><ul id='YqeJd'></ul><sub id='YqeJd'></sub></form><legend id='YqeJd'></legend><bdo id='YqeJd'><pre id='YqeJd'><center id='YqeJd'></center></pre></bdo></b><th id='YqeJd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YqeJd'><tfoot id='YqeJd'></tfoot><dl id='YqeJd'><fieldset id='YqeJd'></fieldset></dl></div>

      1. 基于經緯度進行半徑搜索的SQL查詢

        SQL Query for Performing Radius Search based on Latitude Longitude(基于經緯度進行半徑搜索的SQL查詢)
          <tbody id='bEFIK'></tbody>
      2. <small id='bEFIK'></small><noframes id='bEFIK'>

      3. <i id='bEFIK'><tr id='bEFIK'><dt id='bEFIK'><q id='bEFIK'><span id='bEFIK'><b id='bEFIK'><form id='bEFIK'><ins id='bEFIK'></ins><ul id='bEFIK'></ul><sub id='bEFIK'></sub></form><legend id='bEFIK'></legend><bdo id='bEFIK'><pre id='bEFIK'><center id='bEFIK'></center></pre></bdo></b><th id='bEFIK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bEFIK'><tfoot id='bEFIK'></tfoot><dl id='bEFIK'><fieldset id='bEFIK'></fieldset></dl></div>
          1. <tfoot id='bEFIK'></tfoot>
            • <legend id='bEFIK'><style id='bEFIK'><dir id='bEFIK'><q id='bEFIK'></q></dir></style></legend>

                  <bdo id='bEFIK'></bdo><ul id='bEFIK'></ul>
                  本文介紹了基于經緯度進行半徑搜索的SQL查詢的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我們有一個 restaurant 表,其中包含每一行的經緯度數據.

                  我們需要編寫一個查詢來執行搜索以查找提供的半徑內的所有餐館,例如1 英里、5 英里等.

                  為此,我們有以下查詢:

                  ***參數***經度:-74.008680緯度:40.711676半徑:1英里***詢問***選擇 *從餐廳在哪里 (POW( ( 69.1 * ( 經度 - -74.008680 ) * cos( 40.711676/57.3 ) ) , 2 ) + POW( ( 69.1 * ( 緯度 - 40.711676 ) ) , 2 )) <( 1 *1 );

                  該表有大約 23k 行.結果集的大小有時很奇怪,例如對于 5.4 英里的搜索,它返回 880 行,對于 5.5 英里,它返回 21k 行.

                  此表包含紐約市的餐廳數據 - 因此實際分布與結果集不同.

                  問題:這個查詢有什么問題嗎?

                  <塊引用>

                  數據庫:MySQL,經度:DECIMAL(10,6),緯度:DECIMAL(10,6)

                  解決方案

                  這有什么問題嗎查詢?

                  在我看來,由于涉及數學,WHERE 子句會很慢,并且在 WHERE 子句中使用函數會阻止數據庫使用索引來加速查詢 - 因此,實際上,您將檢查每個數據庫中的餐廳,并在每次查詢時對每一行執行大圓數學運算.

                  我個人會計算一個正方形的 TopLeft 和 BottomRight 坐標(只需要使用畢達哥拉斯進行粗略計算),其邊等于您正在尋找的范圍,然后在該緯度/經度正方形內的較小記錄子集.

                  帶有關于 Lat & 的索引長在數據庫中的查詢

                  <上一頁>WHERE MyLat >= @MinLat AND MyLat <= @MaxLatAND MyLong >= @MinLong AND MyLong <= @MaxLong

                  應該很高效

                  (請注意,我不了解 MySQL,只了解 MS SQL)

                  We have a restaurant table that has lat-long data for each row.

                  We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc.

                  We have the following query for this purpose:

                  ***Parameters***
                  
                  Longitude: -74.008680
                  Latitude: 40.711676
                  Radius: 1 mile
                  
                  ***Query***
                  
                  SELECT *
                  FROM restaurant
                  WHERE (
                  POW( ( 69.1 * ( Longitude - -74.008680 ) * cos( 40.711676 / 57.3 ) ) , 2 ) + POW( ( 69.1 * ( Latitude - 40.711676 ) ) , 2 )
                  ) < ( 1 *1 );
                  

                  The table has about 23k rows. The size of the result set is weird at times e.g. for a 5.4 mile search, it gives back 880 rows and for 5.5 miles, it gives back 21k rows.

                  This table contains restaurant data for nyc - so the real distribution is not as per the result set.

                  Question: IS THERE ANYTHING WRONG With this query?

                  DB: MySQL, Longitude: DECIMAL(10,6), Latitude: DECIMAL(10,6)

                  解決方案

                  IS THERE ANYTHING WRONG With this query?

                  In my opinion the WHERE clause is going to be slow because of the maths involved, and the use of functions in the WHERE clause will prevent the database using an index to speed the query - so, in effect, you will examine every restaurant in the database, and perform the great-circle maths on every row, every time you make a query.

                  Personally I would calculate the TopLeft and BottomRight co-ordinates of a square (which only needs to be crudly calculated using pythagoras) with sides equal to the range you are looking for, and then perform the more complicated WHERE clause test on the smaller subset of records that are within that Lat/Long square.

                  With an Index on Lat & Long in the database the query

                  WHERE     MyLat >= @MinLat AND MyLat <= @MaxLat
                        AND MyLong >= @MinLong AND MyLong <= @MaxLong
                  

                  should be very efficient

                  (Please note that I have no knowledge of MySQL specifically, only of MS SQL)

                  這篇關于基于經緯度進行半徑搜索的SQL查詢的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經度計算 X 和 Y)
                  CLLocation returning negative speed(CLLocation 返回負速度)
                  Calculate bearing between two locations (lat, long)(計算兩個位置之間的方位角(緯度、經度))
                  watchPosition() vs getCurrentPosition() with setTimeout(watchPosition() 與 getCurrentPosition() 與 setTimeout)
                  iOS 6 breaks GeoLocation in webapps (apple-mobile-web-app-capable)(iOS 6 破壞了 webapps 中的 GeoLocation (apple-mobile-web-app-capable))
                  Determine iPhone user#39;s country(確定 iPhone 用戶所在的國家)
                    <tbody id='dSH1T'></tbody>
                  • <bdo id='dSH1T'></bdo><ul id='dSH1T'></ul>

                    <small id='dSH1T'></small><noframes id='dSH1T'>

                        1. <tfoot id='dSH1T'></tfoot>

                            <i id='dSH1T'><tr id='dSH1T'><dt id='dSH1T'><q id='dSH1T'><span id='dSH1T'><b id='dSH1T'><form id='dSH1T'><ins id='dSH1T'></ins><ul id='dSH1T'></ul><sub id='dSH1T'></sub></form><legend id='dSH1T'></legend><bdo id='dSH1T'><pre id='dSH1T'><center id='dSH1T'></center></pre></bdo></b><th id='dSH1T'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dSH1T'><tfoot id='dSH1T'></tfoot><dl id='dSH1T'><fieldset id='dSH1T'></fieldset></dl></div>
                            <legend id='dSH1T'><style id='dSH1T'><dir id='dSH1T'><q id='dSH1T'></q></dir></style></legend>
                            主站蜘蛛池模板: 999国产精品视频免费 | 另类 综合 日韩 欧美 亚洲 | 日韩久草 | 国产伦一区二区三区四区 | 国产一区二区三区 | 欧美在线a| 亚洲美女视频 | 91精品久久久久久久久久 | 狠狠操狠狠干 | 国产一区视频在线 | 成人三级电影 | 成人在线视频一区二区三区 | 中文字幕在线免费观看 | 一区二区三区在线免费 | 毛片大全 | 日韩网站免费观看 | 婷婷久久综合 | 九九热精品视频 | 日韩一区二区三区四区五区六区 | 特黄毛片视频 | 亚洲精品电影在线观看 | 亚洲精品久久久久久一区二区 | 欧美一级特黄aaa大片在线观看 | 91精品国产色综合久久不卡蜜臀 | 99久9 | 久久激情视频 | 国产一区二区三区在线免费观看 | 亚洲激情一区二区 | 亚洲福利网 | 国产精品一区二区视频 | 综合国产第二页 | 免费在线播放黄色 | 天天综合永久入口 | 亚洲高清视频一区二区 | 国色天香综合网 | 五月天国产 | 日日网 | 黑人精品欧美一区二区蜜桃 | 欧美一级片在线播放 | 国产一区二区三区日韩 | 伊人精品久久久久77777 |