* Find the first index where a polygon ring crosses the antimeridian * (a transition from positive to negative longitude between consecutive * points). Returns null when no crossing is found. * * @param {Array >} pts - polygon points as [lon, lat] pairs * @return {number|null} inde
(pts)
| 94 | * @return {number|null} index of the segment that crosses, or null |
| 95 | */ |
| 96 | function doesCrossAntiMeridian(pts) { |
| 97 | for (let l = 0; l < pts.length - 1; l++) { |
| 98 | if (pts[l][0] > 0 && pts[l + 1][0] < 0) return l; |
| 99 | } |
| 100 | |
| 101 | return null; |
| 102 | } |
| 103 | |
| 104 | function feature2polygons(feature) { |
| 105 | var geometry = feature.geometry; |
no outgoing calls
no test coverage detected
searching dependent graphs…