pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<i id='1LRV3'><tr id='1LRV3'><dt id='1LRV3'><q id='1LRV3'><span id='1LRV3'><b id='1LRV3'><form id='1LRV3'><ins id='1LRV3'></ins><ul id='1LRV3'></ul><sub id='1LRV3'></sub></form><legend id='1LRV3'></legend><bdo id='1LRV3'><pre id='1LRV3'><center id='1LRV3'></center></pre></bdo></b><th id='1LRV3'></th></span></q></dt></tr></i><div class="3lftjj3" id='1LRV3'><tfoot id='1LRV3'></tfoot><dl id='1LRV3'><fieldset id='1LRV3'></fieldset></dl></div>
  • <small id='1LRV3'></small><noframes id='1LRV3'>

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

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

        檢查一個多邊形點是否在傳單中的另一個內部

        Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
        <tfoot id='K6Y2q'></tfoot>

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

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

                  <bdo id='K6Y2q'></bdo><ul id='K6Y2q'></ul>
                  <legend id='K6Y2q'><style id='K6Y2q'><dir id='K6Y2q'><q id='K6Y2q'></q></dir></style></legend>
                    <tbody id='K6Y2q'></tbody>

                • 本文介紹了檢查一個多邊形點是否在傳單中的另一個內部的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我從傳單 geoJSON 地圖中選擇了兩組多邊形坐標.父子坐標是坐標是:

                  I'm having two sets of polygon coordinates selected from leaflet geoJSON map. The parent and child coordinates are coordinates are:

                  var parentCoordinates=[
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ]
                  ]
                  var childCoordinates=[
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ]
                  ]
                  

                  child在父區域內繪制如圖:

                  The child is drawn inside the parent area as shown in the picture:

                  使用 Ray Casting 算法 來確定是否點位于多邊形內,我無法確定,因為我得到的結果是錯誤的.請讓我知道我做錯了什么或任何其他方式來確定解決方案.謝謝

                  Using Ray Casting algorithm to determine if the point lies inside polygon I 'm not able to determine as the result I'm getting is false. Please let me know where I'm doing wrong or any other way to determine the solution.Thanks

                  推薦答案

                  我嘗試了你的算法和另一個在這里找到的 https://rosettacode.org/wiki/Ray-casting_algorithm 并且都返回正確的值.

                  I tried with your algorithm and another found here https://rosettacode.org/wiki/Ray-casting_algorithm and both return the right value.

                  也許這個小提琴可以幫助你實現:

                  Maybe this fiddle can help you in the implementation :

                  https://jsfiddle.net/4psL2hoo/1/

                  您的算法

                  // Data
                  var parentCoordinates=[
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ]
                  ]
                  var childCoordinates=[
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ]
                  ]
                  
                  // Other algo
                  function test(point, vs) {
                      // ray-casting algorithm based on
                      // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
                  
                      var x = point[0], y = point[1];
                  
                      var inside = false;
                      for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
                          var xi = vs[i][0], yi = vs[i][1];
                          var xj = vs[j][0], yj = vs[j][1];
                  
                          var intersect = ((yi > y) != (yj > y))
                              && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
                          if (intersect) inside = !inside;
                      }
                  
                      return inside;
                  };
                  
                  for (var i = 0; i < childCoordinates.length; i++) {
                       var testPoint = childCoordinates[i];
                       console.log(JSON.stringify(testPoint) + '	in parentCoordinate	' + test(testPoint, parentCoordinates));
                  }
                  

                  Rosetta 代碼算法

                  //https://rosettacode.org/wiki/Ray-casting_algorithm
                  function contains(bounds, lat, lng) {
                      //https://rosettacode.org/wiki/Ray-casting_algorithm
                      var count = 0;
                      for (var b = 0; b < bounds.length; b++) {
                          var vertex1 = bounds[b];
                          var vertex2 = bounds[(b + 1) % bounds.length];
                          if (west(vertex1, vertex2, lng, lat))
                              ++count;
                      }
                      return count % 2;
                  
                      /**
                       * @return {boolean} true if (x,y) is west of the line segment connecting A and B
                       */
                      function west(A, B, x, y) {
                          if (A.y <= B.y) {
                              if (y <= A.y || y > B.y ||
                                  x >= A.x && x >= B.x) {
                                  return false;
                              } else if (x < A.x && x < B.x) {
                                  return true;
                              } else {
                                  return (y - A.y) / (x - A.x) > (B.y - A.y) / (B.x - A.x);
                              }
                          } else {
                              return west(B, A, x, y);
                          }
                      }
                  }
                  
                  var square = {name: 'square', bounds: [{x: 32.05898221582174, y: -28.31004731142091}, {x: 32.05898221582174, y: -28.308044824292978}, {x: 32.06134255975485, y: -28.308044824292978}, {x: 32.06134255975485, y: -28.31004731142091}]};
                  
                  var shapes = [square];
                  var testPoints = [{lng: 32.059904895722866, lat: -28.30970726909422}, {lng: 32.059904895722866, lat: -28.308743809931784}, {lng: 32.06089194864035, lat: -28.308743809931784},
                      {lng: 32.06089194864035, lat: -28.30970726909422}];
                  
                  for (var s = 0; s < shapes.length; s++) {
                      var shape = shapes[s];
                      for (var tp = 0; tp < testPoints.length; tp++) {
                          var testPoint = testPoints[tp];
                          console.log(JSON.stringify(testPoint) + '	in ' + shape.name + '	' + contains(shape.bounds, testPoint.lat, testPoint.lng));
                      }
                  }
                  

                  這篇關于檢查一個多邊形點是否在傳單中的另一個內部的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)
                • <tfoot id='aBBiL'></tfoot>
                  <legend id='aBBiL'><style id='aBBiL'><dir id='aBBiL'><q id='aBBiL'></q></dir></style></legend>

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

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

                              <tbody id='aBBiL'></tbody>

                          • 主站蜘蛛池模板: 自动部分收集器,进口无油隔膜真空泵,SPME固相微萃取头-上海楚定分析仪器有限公司 | 北京网站建设公司_北京网站制作公司_北京网站设计公司-北京爱品特网站建站公司 | 贝朗斯动力商城(BRCPOWER.COM) - 买叉车蓄电池上贝朗斯商城,价格更超值,品质有保障! | ERP企业管理系统永久免费版_在线ERP系统_OA办公_云版软件官网 | 千斤顶,液压千斤顶-力良企业,专业的液压千斤顶制造商,shliliang.com | 沧州友城管业有限公司-内外涂塑钢管-大口径螺旋钢管-涂塑螺旋管-保温钢管生产厂家 | 长沙广告公司|长沙广告制作设计|长沙led灯箱招牌制作找望城湖南锦蓝广告装饰工程有限公司 | 全屋整木定制-橱柜,家具定制-四川峨眉山龙马木业有限公司 | 上海律师事务所_上海刑事律师免费咨询平台-煊宏律师事务所 | 挨踢网-大家的导航!| 附着力促进剂-尼龙处理剂-PP处理剂-金属附着力处理剂-东莞市炅盛塑胶科技有限公司 | 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 网优资讯-为循环资源、大宗商品、工业服务提供资讯与行情分析的数据服务平台 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 陶瓷砂磨机,盘式砂磨机,棒销式砂磨机-无锡市少宏粉体科技有限公司 | 压力控制器,差压控制器,温度控制器,防爆压力控制器,防爆温度控制器,防爆差压控制器-常州天利智能控制股份有限公司 | 搬运设备、起重设备、吊装设备—『龙海起重成套设备』 | 实验室pH计|电导率仪|溶解氧测定仪|离子浓度计|多参数水质分析仪|pH电极-上海般特仪器有限公司 | 河南mpp电力管_mpp电力管生产厂家_mpp电力电缆保护管价格 - 河南晨翀实业 | 橡胶接头|可曲挠橡胶接头|橡胶软接头安装使用教程-上海松夏官方网站 | 3d打印服务,3d打印汽车,三维扫描,硅胶复模,手板,快速模具,深圳市精速三维打印科技有限公司 | 吸污车_吸粪车_抽粪车_电动三轮吸粪车_真空吸污车_高压清洗吸污车-远大汽车制造有限公司 | 成都顶呱呱信息技术有限公司-贷款_个人贷款_银行贷款在线申请 - 成都贷款公司 | 有机废气处理-rto焚烧炉-催化燃烧设备-VOC冷凝回收装置-三梯环境 | 档案密集架_电动密集架_移动密集架_辽宁档案密集架-盛隆柜业厂家现货批发销售价格公道 | IHDW_TOSOKU_NEMICON_EHDW系列电子手轮,HC1系列电子手轮-上海莆林电子设备有限公司 | 江苏密集柜_电动_手动_移动_盛隆柜业江苏档案密集柜厂家 | 轻型地埋电缆故障测试仪,频响法绕组变形测试仪,静荷式卧式拉力试验机-扬州苏电 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 金环宇|金环宇电线|金环宇电缆|金环宇电线电缆|深圳市金环宇电线电缆有限公司|金环宇电缆集团 | 特种阀门-调节阀门-高温熔盐阀-镍合金截止阀-钛阀门-高温阀门-高性能蝶阀-蒙乃尔合金阀门-福建捷斯特阀门制造有限公司 | 北京网站建设公司_北京网站制作公司_北京网站设计公司-北京爱品特网站建站公司 | 华夏医界网_民营医疗产业信息平台_民营医院营销管理培训 | 陶瓷砂磨机,盘式砂磨机,棒销式砂磨机-无锡市少宏粉体科技有限公司 | 热熔胶网膜|pes热熔网膜价格|eva热熔胶膜|热熔胶膜|tpu热熔胶膜厂家-苏州惠洋胶粘制品有限公司 | 深圳昂为官网-气体分析仪,沼气分析仪,动态配气仪,气体传感器厂家 | 蔬菜配送公司|蔬菜配送中心|食材配送|饭堂配送|食堂配送-首宏公司 | 收录网| 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 深圳展厅设计_企业展馆设计_展厅设计公司_数字展厅设计_深圳百艺堂 |