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

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

        • <bdo id='zCttR'></bdo><ul id='zCttR'></ul>
      1. <legend id='zCttR'><style id='zCttR'><dir id='zCttR'><q id='zCttR'></q></dir></style></legend>

        如何在mysql查询中找到所选对角线区域之间的准确

        时间:2023-09-25
          <tbody id='bHNt3'></tbody>
      2. <i id='bHNt3'><tr id='bHNt3'><dt id='bHNt3'><q id='bHNt3'><span id='bHNt3'><b id='bHNt3'><form id='bHNt3'><ins id='bHNt3'></ins><ul id='bHNt3'></ul><sub id='bHNt3'></sub></form><legend id='bHNt3'></legend><bdo id='bHNt3'><pre id='bHNt3'><center id='bHNt3'></center></pre></bdo></b><th id='bHNt3'></th></span></q></dt></tr></i><div id='bHNt3'><tfoot id='bHNt3'></tfoot><dl id='bHNt3'><fieldset id='bHNt3'></fieldset></dl></div>
          <bdo id='bHNt3'></bdo><ul id='bHNt3'></ul>

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

                1. <legend id='bHNt3'><style id='bHNt3'><dir id='bHNt3'><q id='bHNt3'></q></dir></style></legend>

                  <tfoot id='bHNt3'></tfoot>

                  本文介绍了如何在mysql查询中找到所选对角线区域之间的准确数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这些是我选择的对角线点的坐标,选择的点越多就会越多.

                  These are my coordinates of Selected diagonal points, will be more when selected points are more.

                  1: 25.312063043186914  2: 55.30672073364258
                  1: 25.24096949112138   2: 55.40525436401367
                  1: 25.224509592006314  2: 55.3462028503418
                  1: 25.22513076073063   2: 55.281314849853516
                  1: 25.27822894908031   2: 55.25899887084961
                  

                  下面是我当前的 mysql 查询在选定的对角线之间没有给我完美的结果.有帮助吗??

                  below is my current mysql query not giving me perfect result between selected diagonal.any help??

                  SELECT 
                    * 
                  FROM
                    tbl_custom 
                  WHERE latitude <= 25.312063043186914 
                    AND latitude >= 25.224509592006314 
                    AND longitude <= 55.40525436401367 
                    AND longitude >= 55.25899887084961 
                  

                  推荐答案

                  要消除边界框查询内但不在多边形内的点,您需要使用 多边形中的点 算法.

                  To eliminate the points within your bounding box query but not within polygon you require to use Point in Polygon algorithm.

                  最简单的方法是使用数组中的坐标.这些可用于查找查询的最大和最小坐标以及 pointInPolygon() 函数的参数.

                  The easiest way to do this is to have the coordinates in arrays. These can be used to find max and min coordinates for the query and for parameters for pointInPolygon() function.

                  function pointInPolygon(polySides,polyX,polyY,x,y) {
                   var j = polySides-1 ;
                    oddNodes = 0;
                    for (i=0; i<polySides; i++) {
                      if (polyY[i]<y && polyY[j]>=y  ||  polyY[j]<y && polyY[i]>=y) {
                          if (polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x)  {
                              oddNodes=!oddNodes; 
                          }
                      }
                     j=i; }
                  
                    return oddNodes;
                  }
                  

                  在您的地图代码中使用 jQuery getJSON()

                  In your Map code using jQuery getJSON()

                  var polySides = 4;//number of points in polygon
                  //horizontal Latitude coordinates of polygon  
                  var polyLat = new Array();
                  polyLat[0] = 51.5;
                  polyLat[1] = 51.5;
                  polyLat[2] = 52.5;
                  polyLat[3] = 53;
                  polyLat[4] = 51.5;//First point repeated to close polygon
                  //vertical Longitude coordinates of polygon 
                  var polyLng =  new Array();
                  polyLng[0] = 0.5;
                  polyLng[1] = -1.9;
                  polyLng[2] = -1;
                  polyLng[3] = 0.6;
                  polyLng[4] = 0.5;
                  //Coordinates for bounding box
                  var maxLat = Math.max.apply(null,polyLat);
                  var minLat = Math.min.apply(null,polyLat);
                  var maxLng = Math.max.apply(null,polyLng);
                  var minLng = Math.min.apply(null,polyLng);
                  
                  //Using jQuery
                  var url = "yourFile .php";
                   url +="?maxLat="+maxLat +"&minLat="+minLat +"&maxLng="+maxLng +"&minLng="+minLng;
                   $.getJSON(url,function(data) {
                      $.each(data.marker,function(i,dat){
                          if (pointInPolygon(polySides,polyLat,polyLng,dat.lat,dat.lng)){
                              var latlng = new google.maps.LatLng(dat.lat,dat.lng); 
                              addMarker(latlng,dat.name);
                              bounds.extend(latlng);
                          }
                      });
                      map.fitBounds(bounds);
                  });
                  

                  使用边界框和多边形中的点获得的地图.

                  Map obtained using Bounding Box and Point in Polygon.

                  这篇关于如何在mysql查询中找到所选对角线区域之间的准确数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:查找邮政编码 10 英里范围内的城镇.谷歌地图AP 下一篇:使用谷歌地图、PHP 和 MySQL 从 A 点到 B 点的距离

                  相关文章

                  最新文章

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

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

                  2. <small id='PWsM6'></small><noframes id='PWsM6'>

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