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

Function clampToAntimeridian

topojson/bin/process_geodata.mjs:66–72  ·  view source on GitHub ↗
(inputFilepath, outputFilepath)

Source from the content-addressed store, hash-verified

64
65// Clamp x-coordinates to the antimeridian
66function clampToAntimeridian(inputFilepath, outputFilepath) {
67 outputFilepath ||= inputFilepath;
68 const jsonString = fs.readFileSync(inputFilepath, 'utf8');
69 const updatedString = jsonString.replaceAll(/179\.9999\d+,/g, '180,').replaceAll(/180\.0000\d+,/g, '180,');
70
71 fs.writeFileSync(outputFilepath, updatedString);
72}
73
74function pruneProperties(topojson) {
75 for (const layer in topojson.objects) {

Callers 2

createCoastlinesLayerFunction · 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…