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>

                          • 主站蜘蛛池模板: 粉碎机_塑料粉碎机_塑料破碎机厂家-星标机械 | 锂电混合机-新能源混合机-正极材料混料机-高镍,三元材料混料机-负极,包覆混合机-贝尔专业混合混料搅拌机械系统设备厂家 | 国产离子色谱仪,红外分光测油仪,自动烟尘烟气测试仪-青岛埃仑通用科技有限公司 | 紫外可见光分光度计-紫外分光度计-分光光度仪-屹谱仪器制造(上海)有限公司 | 洛阳永磁工业大吊扇研发生产-工厂通风降温解决方案提供商-中实洛阳环境科技有限公司 | MOOG伺服阀维修,ATOS比例流量阀维修,伺服阀维修-上海纽顿液压设备有限公司 | 高防护蠕动泵-多通道灌装系统-高防护蠕动泵-www.bjhuiyufluid.com慧宇伟业(北京)流体设备有限公司 | 袋式过滤器,自清洗过滤器,保安过滤器,篮式过滤器,气体过滤器,全自动过滤器,反冲洗过滤器,管道过滤器,无锡驰业环保科技有限公司 | 液压中心架,数控中心架,自定心中心架-烟台恒阳机电设计有限公司 行星搅拌机,双行星搅拌机,动力混合机,无锡米克斯行星搅拌机生产厂家 | 中开泵,中开泵厂家,双吸中开泵-山东博二泵业有限公司 | 锡膏喷印机-全自动涂覆机厂家-全自动点胶机-视觉点胶机-深圳市博明智控科技有限公司 | 智成电子深圳tdk一级代理-提供TDK电容电感贴片蜂鸣器磁芯lambda电源代理经销,TDK代理商有哪些TDK一级代理商排名查询。-深圳tdk一级代理 | 专业广州网站建设,微信小程序开发,一物一码和NFC应用开发、物联网、外贸商城、定制系统和APP开发【致茂网络】 | 北京模型公司-军事模型-工业模型制作-北京百艺模型沙盘公司 | 干粉砂浆设备-干粉砂浆生产线-干混-石膏-保温砂浆设备生产线-腻子粉设备厂家-国恒机械 | 升降炉_真空气氛炉_管式电阻炉厂家-山东中辰电炉有限公司 | 磁力抛光研磨机_超声波清洗机厂家_去毛刺设备-中锐达数控 | 河北凯普威医疗器材有限公司,高档轮椅系列,推车系列,座厕椅系列,协步椅系列,拐扙系列,卫浴系列 | 福建成考网-福建成人高考网 | 自动气象站_气象站监测设备_全自动气象站设备_雨量监测站-山东风途物联网 | 碳纤维布-植筋胶-灌缝胶-固特嘉加固材料公司 | 国产液相色谱仪-超高效液相色谱仪厂家-上海伍丰科学仪器有限公司 | 工业车间焊接-整体|集中除尘设备-激光|等离子切割机配套除尘-粉尘烟尘净化治理厂家-山东美蓝环保科技有限公司 | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 | MES系统工业智能终端_生产管理看板/安灯/ESOP/静电监控_讯鹏科技 | 葡萄酒灌装机-食用油灌装机-液体肥灌装设备厂家_青州惠联灌装机械 | 布袋式除尘器|木工除尘器|螺旋输送机|斗式提升机|刮板输送机|除尘器配件-泊头市德佳环保设备 | 乐泰胶水_loctite_乐泰胶_汉高乐泰授权(中国)总代理-鑫华良供应链 | 带锯机|木工带锯机圆木推台锯|跑车带锯机|河北茂业机械制造有限公司| | 月嫂_保姆_育婴_催乳_母婴护理_产后康复_养老护理-吉祥到家家政 硫酸亚铁-聚合硫酸铁-除氟除磷剂-复合碳源-污水处理药剂厂家—长隆科技 | 杭州ROHS检测仪-XRF测试仪价格-百科 | 蓝莓施肥机,智能施肥机,自动施肥机,水肥一体化项目,水肥一体机厂家,小型施肥机,圣大节水,滴灌施工方案,山东圣大节水科技有限公司官网17864474793 | 大倾角皮带机-皮带输送机-螺旋输送机-矿用皮带输送机价格厂家-河南坤威机械 | 压接机|高精度压接机|手动压接机|昆明可耐特科技有限公司[官网] 胶泥瓷砖胶,轻质粉刷石膏,嵌缝石膏厂家,腻子粉批发,永康家德兴,永康市家德兴建材厂 | 济南货架定做_仓储货架生产厂_重型货架厂_仓库货架批发_济南启力仓储设备有限公司 | 苏州防水公司_厂房屋面外墙防水_地下室卫生间防水堵漏-苏州伊诺尔防水工程有限公司 | 丙烷/液氧/液氮气化器,丙烷/液氧/液氮汽化器-无锡舍勒能源科技有限公司 | 真空粉体取样阀,电动楔式闸阀,电动针型阀-耐苛尔(上海)自动化仪表有限公司 | 珠海网站建设_响应网站建设_珠海建站公司_珠海网站设计与制作_珠海网讯互联 | 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | 煤机配件厂家_刮板机配件_链轮轴组_河南双志机械设备有限公司 |