/** 
             * 计算一个点是否在多边形里 
             * @param {Object} pt 标注点 
             * @param {Object} poly 多边形数组 
             */  
            function isInsidePolygon(pt, poly){  
                for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)   
                    ((poly[i].lat <= pt.lat && pt.lat < poly[j].lat) || (poly[j].lat <= pt.lat && pt.lat < poly[i].lat)) &&  
                    (pt.lng < (poly[j].lng - poly[i].lng) * (pt.lat - poly[i].lat) / (poly[j].lat - poly[i].lat) + poly[i].lng) &&  
                    (c = !c);  
                return c;  
            }

  

相关文章:

  • 2022-12-23
  • 2021-11-14
  • 2022-02-16
  • 2022-01-08
  • 2022-12-23
  • 2021-05-05
猜你喜欢
  • 2022-12-23
  • 2021-10-07
  • 2021-08-23
  • 2022-01-02
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案