code: function insidePolygon(rings, p) {
      var inside = false;
      for (var i = 0, len = rings.length; i < len; i++) {
          var ring = rings[i];
          for (var j = 0, len2 = ring.length, k = len2 - 1; j < len2; k = j++) {
              if (rayIntersect(p, ring[j], ring[k])) inside = !inside;
          }
      }
      return inside;
  }
docs: ray casting algorithm for detecting if point is in polygon