MCPcopy Create free account
hub / github.com/plotly/plotly.js / doesCrossAntiMeridian

Function doesCrossAntiMeridian

src/lib/geo_location_utils.js:96–102  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

94 * @return {number|null} index of the segment that crosses, or null
95 */
96function 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
104function feature2polygons(feature) {
105 var geometry = feature.geometry;

Callers 2

feature2polygonsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…