function format([x, y]) {
const dir = [["N", "S"], ["E", "W"]];
return [y, x].map((d, i) => {
const suffix = d >= 0 ? dir[i][0] : dir[i][1];
const rawDeg = Math.abs(d);
const deg = Math.floor(rawDeg);
const rawMin = (rawDeg - Math.floor(deg)) * 60;
const min = Math.floor(rawMin);
const rawSec = (rawMin - min) * 60;
const sec = Math.floor(rawSec);
return `${deg}°${d3.format("02")(min)}'${d3.format("02")(sec)}''${suffix}`;
});
}