@rapideditor/location-conflation
Version:
Define complex geographic regions by including and excluding country codes and geojson shapes
1,041 lines (1,025 loc) • 831 kB
JavaScript
(() => {
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __hasOwnProp = Object.prototype.hasOwnProperty;
function __accessProp(key) {
return this[key];
}
var __toESMCache_node;
var __toESMCache_esm;
var __toESM = (mod, isNodeMode, target) => {
var canCache = mod != null && typeof mod === "object";
if (canCache) {
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
var cached = cache.get(mod);
if (cached)
return cached;
}
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: __accessProp.bind(mod, key),
enumerable: true
});
if (canCache)
cache.set(mod, to);
return to;
};
var __toCommonJS = (from) => {
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
if (entry)
return entry;
entry = __defProp({}, "__esModule", { value: true });
if (from && typeof from === "object" || typeof from === "function") {
for (var key of __getOwnPropNames(from))
if (!__hasOwnProp.call(entry, key))
__defProp(entry, key, {
get: __accessProp.bind(from, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
__moduleCache.set(from, entry);
return entry;
};
var __moduleCache;
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: __exportSetter.bind(all, name)
});
};
// node_modules/quickselect/quickselect.js
var require_quickselect = __commonJS((exports, module) => {
(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.quickselect = factory();
})(exports, function() {
function quickselect(arr, k, left, right, compare) {
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
}
function quickselectStep(arr, k, left, right, compare) {
while (right > left) {
if (right - left > 600) {
var n = right - left + 1;
var m = k - left + 1;
var z = Math.log(n);
var s = 0.5 * Math.exp(2 * z / 3);
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
quickselectStep(arr, k, newLeft, newRight, compare);
}
var t = arr[k];
var i = left;
var j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0)
swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0)
i++;
while (compare(arr[j], t) > 0)
j--;
}
if (compare(arr[left], t) === 0)
swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k)
left = j + 1;
if (k <= j)
right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
return quickselect;
});
});
// node_modules/rbush/index.js
var require_rbush = __commonJS((exports, module) => {
module.exports = rbush;
module.exports.default = rbush;
var quickselect = require_quickselect();
function rbush(maxEntries, format) {
if (!(this instanceof rbush))
return new rbush(maxEntries, format);
this._maxEntries = Math.max(4, maxEntries || 9);
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
if (format) {
this._initFormat(format);
}
this.clear();
}
rbush.prototype = {
all: function() {
return this._all(this.data, []);
},
search: function(bbox) {
var node = this.data, result = [], toBBox = this.toBBox;
if (!intersects(bbox, node))
return result;
var nodesToSearch = [], i, len, child, childBBox;
while (node) {
for (i = 0, len = node.children.length;i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf)
result.push(child);
else if (contains(bbox, childBBox))
this._all(child, result);
else
nodesToSearch.push(child);
}
}
node = nodesToSearch.pop();
}
return result;
},
collides: function(bbox) {
var node = this.data, toBBox = this.toBBox;
if (!intersects(bbox, node))
return false;
var nodesToSearch = [], i, len, child, childBBox;
while (node) {
for (i = 0, len = node.children.length;i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf || contains(bbox, childBBox))
return true;
nodesToSearch.push(child);
}
}
node = nodesToSearch.pop();
}
return false;
},
load: function(data) {
if (!(data && data.length))
return this;
if (data.length < this._minEntries) {
for (var i = 0, len = data.length;i < len; i++) {
this.insert(data[i]);
}
return this;
}
var node = this._build(data.slice(), 0, data.length - 1, 0);
if (!this.data.children.length) {
this.data = node;
} else if (this.data.height === node.height) {
this._splitRoot(this.data, node);
} else {
if (this.data.height < node.height) {
var tmpNode = this.data;
this.data = node;
node = tmpNode;
}
this._insert(node, this.data.height - node.height - 1, true);
}
return this;
},
insert: function(item) {
if (item)
this._insert(item, this.data.height - 1);
return this;
},
clear: function() {
this.data = createNode([]);
return this;
},
remove: function(item, equalsFn) {
if (!item)
return this;
var node = this.data, bbox = this.toBBox(item), path = [], indexes = [], i, parent, index, goingUp;
while (node || path.length) {
if (!node) {
node = path.pop();
parent = path[path.length - 1];
i = indexes.pop();
goingUp = true;
}
if (node.leaf) {
index = findItem(item, node.children, equalsFn);
if (index !== -1) {
node.children.splice(index, 1);
path.push(node);
this._condense(path);
return this;
}
}
if (!goingUp && !node.leaf && contains(node, bbox)) {
path.push(node);
indexes.push(i);
i = 0;
parent = node;
node = node.children[0];
} else if (parent) {
i++;
node = parent.children[i];
goingUp = false;
} else
node = null;
}
return this;
},
toBBox: function(item) {
return item;
},
compareMinX: compareNodeMinX,
compareMinY: compareNodeMinY,
toJSON: function() {
return this.data;
},
fromJSON: function(data) {
this.data = data;
return this;
},
_all: function(node, result) {
var nodesToSearch = [];
while (node) {
if (node.leaf)
result.push.apply(result, node.children);
else
nodesToSearch.push.apply(nodesToSearch, node.children);
node = nodesToSearch.pop();
}
return result;
},
_build: function(items, left, right, height) {
var N = right - left + 1, M = this._maxEntries, node;
if (N <= M) {
node = createNode(items.slice(left, right + 1));
calcBBox(node, this.toBBox);
return node;
}
if (!height) {
height = Math.ceil(Math.log(N) / Math.log(M));
M = Math.ceil(N / Math.pow(M, height - 1));
}
node = createNode([]);
node.leaf = false;
node.height = height;
var N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M)), i, j, right2, right3;
multiSelect(items, left, right, N1, this.compareMinX);
for (i = left;i <= right; i += N1) {
right2 = Math.min(i + N1 - 1, right);
multiSelect(items, i, right2, N2, this.compareMinY);
for (j = i;j <= right2; j += N2) {
right3 = Math.min(j + N2 - 1, right2);
node.children.push(this._build(items, j, right3, height - 1));
}
}
calcBBox(node, this.toBBox);
return node;
},
_chooseSubtree: function(bbox, node, level, path) {
var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;
while (true) {
path.push(node);
if (node.leaf || path.length - 1 === level)
break;
minArea = minEnlargement = Infinity;
for (i = 0, len = node.children.length;i < len; i++) {
child = node.children[i];
area = bboxArea(child);
enlargement = enlargedArea(bbox, child) - area;
if (enlargement < minEnlargement) {
minEnlargement = enlargement;
minArea = area < minArea ? area : minArea;
targetNode = child;
} else if (enlargement === minEnlargement) {
if (area < minArea) {
minArea = area;
targetNode = child;
}
}
}
node = targetNode || node.children[0];
}
return node;
},
_insert: function(item, level, isNode) {
var toBBox = this.toBBox, bbox = isNode ? item : toBBox(item), insertPath = [];
var node = this._chooseSubtree(bbox, this.data, level, insertPath);
node.children.push(item);
extend(node, bbox);
while (level >= 0) {
if (insertPath[level].children.length > this._maxEntries) {
this._split(insertPath, level);
level--;
} else
break;
}
this._adjustParentBBoxes(bbox, insertPath, level);
},
_split: function(insertPath, level) {
var node = insertPath[level], M = node.children.length, m = this._minEntries;
this._chooseSplitAxis(node, m, M);
var splitIndex = this._chooseSplitIndex(node, m, M);
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
newNode.height = node.height;
newNode.leaf = node.leaf;
calcBBox(node, this.toBBox);
calcBBox(newNode, this.toBBox);
if (level)
insertPath[level - 1].children.push(newNode);
else
this._splitRoot(node, newNode);
},
_splitRoot: function(node, newNode) {
this.data = createNode([node, newNode]);
this.data.height = node.height + 1;
this.data.leaf = false;
calcBBox(this.data, this.toBBox);
},
_chooseSplitIndex: function(node, m, M) {
var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
minOverlap = minArea = Infinity;
for (i = m;i <= M - m; i++) {
bbox1 = distBBox(node, 0, i, this.toBBox);
bbox2 = distBBox(node, i, M, this.toBBox);
overlap = intersectionArea(bbox1, bbox2);
area = bboxArea(bbox1) + bboxArea(bbox2);
if (overlap < minOverlap) {
minOverlap = overlap;
index = i;
minArea = area < minArea ? area : minArea;
} else if (overlap === minOverlap) {
if (area < minArea) {
minArea = area;
index = i;
}
}
}
return index;
},
_chooseSplitAxis: function(node, m, M) {
var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY);
if (xMargin < yMargin)
node.children.sort(compareMinX);
},
_allDistMargin: function(node, m, M, compare) {
node.children.sort(compare);
var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i, child;
for (i = m;i < M - m; i++) {
child = node.children[i];
extend(leftBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(leftBBox);
}
for (i = M - m - 1;i >= m; i--) {
child = node.children[i];
extend(rightBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(rightBBox);
}
return margin;
},
_adjustParentBBoxes: function(bbox, path, level) {
for (var i = level;i >= 0; i--) {
extend(path[i], bbox);
}
},
_condense: function(path) {
for (var i = path.length - 1, siblings;i >= 0; i--) {
if (path[i].children.length === 0) {
if (i > 0) {
siblings = path[i - 1].children;
siblings.splice(siblings.indexOf(path[i]), 1);
} else
this.clear();
} else
calcBBox(path[i], this.toBBox);
}
},
_initFormat: function(format) {
var compareArr = ["return a", " - b", ";"];
this.compareMinX = new Function("a", "b", compareArr.join(format[0]));
this.compareMinY = new Function("a", "b", compareArr.join(format[1]));
this.toBBox = new Function("a", "return {minX: a" + format[0] + ", minY: a" + format[1] + ", maxX: a" + format[2] + ", maxY: a" + format[3] + "};");
}
};
function findItem(item, items, equalsFn) {
if (!equalsFn)
return items.indexOf(item);
for (var i = 0;i < items.length; i++) {
if (equalsFn(item, items[i]))
return i;
}
return -1;
}
function calcBBox(node, toBBox) {
distBBox(node, 0, node.children.length, toBBox, node);
}
function distBBox(node, k, p, toBBox, destNode) {
if (!destNode)
destNode = createNode(null);
destNode.minX = Infinity;
destNode.minY = Infinity;
destNode.maxX = -Infinity;
destNode.maxY = -Infinity;
for (var i = k, child;i < p; i++) {
child = node.children[i];
extend(destNode, node.leaf ? toBBox(child) : child);
}
return destNode;
}
function extend(a, b) {
a.minX = Math.min(a.minX, b.minX);
a.minY = Math.min(a.minY, b.minY);
a.maxX = Math.max(a.maxX, b.maxX);
a.maxY = Math.max(a.maxY, b.maxY);
return a;
}
function compareNodeMinX(a, b) {
return a.minX - b.minX;
}
function compareNodeMinY(a, b) {
return a.minY - b.minY;
}
function bboxArea(a) {
return (a.maxX - a.minX) * (a.maxY - a.minY);
}
function bboxMargin(a) {
return a.maxX - a.minX + (a.maxY - a.minY);
}
function enlargedArea(a, b) {
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
}
function intersectionArea(a, b) {
var minX = Math.max(a.minX, b.minX), minY = Math.max(a.minY, b.minY), maxX = Math.min(a.maxX, b.maxX), maxY = Math.min(a.maxY, b.maxY);
return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
}
function contains(a, b) {
return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
}
function intersects(a, b) {
return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
}
function createNode(children) {
return {
children,
height: 1,
leaf: true,
minX: Infinity,
minY: Infinity,
maxX: -Infinity,
maxY: -Infinity
};
}
function multiSelect(arr, left, right, n, compare) {
var stack = [left, right], mid;
while (stack.length) {
right = stack.pop();
left = stack.pop();
if (right - left <= n)
continue;
mid = left + Math.ceil((right - left) / n / 2) * n;
quickselect(arr, mid, left, right, compare);
stack.push(left, mid, mid, right);
}
}
});
// node_modules/lineclip/index.js
var require_lineclip = __commonJS((exports, module) => {
module.exports = lineclip;
lineclip.polyline = lineclip;
lineclip.polygon = polygonclip;
function lineclip(points, bbox, result) {
var len = points.length, codeA = bitCode(points[0], bbox), part = [], i, a, b, codeB, lastCode;
if (!result)
result = [];
for (i = 1;i < len; i++) {
a = points[i - 1];
b = points[i];
codeB = lastCode = bitCode(b, bbox);
while (true) {
if (!(codeA | codeB)) {
part.push(a);
if (codeB !== lastCode) {
part.push(b);
if (i < len - 1) {
result.push(part);
part = [];
}
} else if (i === len - 1) {
part.push(b);
}
break;
} else if (codeA & codeB) {
break;
} else if (codeA) {
a = intersect(a, b, codeA, bbox);
codeA = bitCode(a, bbox);
} else {
b = intersect(a, b, codeB, bbox);
codeB = bitCode(b, bbox);
}
}
codeA = lastCode;
}
if (part.length)
result.push(part);
return result;
}
function polygonclip(points, bbox) {
var result, edge, prev, prevInside, i, p, inside;
for (edge = 1;edge <= 8; edge *= 2) {
result = [];
prev = points[points.length - 1];
prevInside = !(bitCode(prev, bbox) & edge);
for (i = 0;i < points.length; i++) {
p = points[i];
inside = !(bitCode(p, bbox) & edge);
if (inside !== prevInside)
result.push(intersect(prev, p, edge, bbox));
if (inside)
result.push(p);
prev = p;
prevInside = inside;
}
points = result;
if (!points.length)
break;
}
return result;
}
function intersect(a, b, edge, bbox) {
return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox[3] - a[1]) / (b[1] - a[1]), bbox[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox[1] - a[1]) / (b[1] - a[1]), bbox[1]] : edge & 2 ? [bbox[2], a[1] + (b[1] - a[1]) * (bbox[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox[0], a[1] + (b[1] - a[1]) * (bbox[0] - a[0]) / (b[0] - a[0])] : null;
}
function bitCode(p, bbox) {
var code = 0;
if (p[0] < bbox[0])
code |= 1;
else if (p[0] > bbox[2])
code |= 2;
if (p[1] < bbox[1])
code |= 4;
else if (p[1] > bbox[3])
code |= 8;
return code;
}
});
// node_modules/which-polygon/index.js
var require_which_polygon = __commonJS((exports, module) => {
var rbush = require_rbush();
var lineclip = require_lineclip();
module.exports = whichPolygon;
function whichPolygon(data) {
var bboxes = [];
for (var i = 0;i < data.features.length; i++) {
var feature = data.features[i];
if (!feature.geometry)
continue;
var coords = feature.geometry.coordinates;
if (feature.geometry.type === "Polygon") {
bboxes.push(treeItem(coords, feature.properties));
} else if (feature.geometry.type === "MultiPolygon") {
for (var j = 0;j < coords.length; j++) {
bboxes.push(treeItem(coords[j], feature.properties));
}
}
}
var tree = rbush().load(bboxes);
function query(p, multi) {
var output = [], result = tree.search({
minX: p[0],
minY: p[1],
maxX: p[0],
maxY: p[1]
});
for (var i2 = 0;i2 < result.length; i2++) {
if (insidePolygon(result[i2].coords, p)) {
if (multi)
output.push(result[i2].props);
else
return result[i2].props;
}
}
return multi && output.length ? output : null;
}
query.tree = tree;
query.bbox = function queryBBox(bbox) {
var output = [];
var result = tree.search({
minX: bbox[0],
minY: bbox[1],
maxX: bbox[2],
maxY: bbox[3]
});
for (var i2 = 0;i2 < result.length; i2++) {
if (polygonIntersectsBBox(result[i2].coords, bbox)) {
output.push(result[i2].props);
}
}
return output;
};
return query;
}
function polygonIntersectsBBox(polygon, bbox) {
var bboxCenter = [
(bbox[0] + bbox[2]) / 2,
(bbox[1] + bbox[3]) / 2
];
if (insidePolygon(polygon, bboxCenter))
return true;
for (var i = 0;i < polygon.length; i++) {
if (lineclip(polygon[i], bbox).length > 0)
return true;
}
return false;
}
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;
}
function rayIntersect(p, p1, p2) {
return p1[1] > p[1] !== p2[1] > p[1] && p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0];
}
function treeItem(coords, props) {
var item = {
minX: Infinity,
minY: Infinity,
maxX: -Infinity,
maxY: -Infinity,
coords,
props
};
for (var i = 0;i < coords[0].length; i++) {
var p = coords[0][i];
item.minX = Math.min(item.minX, p[0]);
item.minY = Math.min(item.minY, p[1]);
item.maxX = Math.max(item.maxX, p[0]);
item.maxY = Math.max(item.maxY, p[1]);
}
return item;
}
});
// node_modules/wgs84/index.js
var require_wgs84 = __commonJS((exports, module) => {
exports.RADIUS = 6378137;
exports.FLATTENING = 1 / 298.257223563;
exports.POLAR_RADIUS = 6356752.3142;
});
// node_modules/@mapbox/geojson-area/index.js
var require_geojson_area = __commonJS((exports, module) => {
var wgs84 = require_wgs84();
exports.geometry = geometry;
exports.ring = ringArea;
function geometry(_) {
var area = 0, i;
switch (_.type) {
case "Polygon":
return polygonArea(_.coordinates);
case "MultiPolygon":
for (i = 0;i < _.coordinates.length; i++) {
area += polygonArea(_.coordinates[i]);
}
return area;
case "Point":
case "MultiPoint":
case "LineString":
case "MultiLineString":
return 0;
case "GeometryCollection":
for (i = 0;i < _.geometries.length; i++) {
area += geometry(_.geometries[i]);
}
return area;
}
}
function polygonArea(coords) {
var area = 0;
if (coords && coords.length > 0) {
area += Math.abs(ringArea(coords[0]));
for (var i = 1;i < coords.length; i++) {
area -= Math.abs(ringArea(coords[i]));
}
}
return area;
}
function ringArea(coords) {
var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i, area = 0, coordsLength = coords.length;
if (coordsLength > 2) {
for (i = 0;i < coordsLength; i++) {
if (i === coordsLength - 2) {
lowerIndex = coordsLength - 2;
middleIndex = coordsLength - 1;
upperIndex = 0;
} else if (i === coordsLength - 1) {
lowerIndex = coordsLength - 1;
middleIndex = 0;
upperIndex = 1;
} else {
lowerIndex = i;
middleIndex = i + 1;
upperIndex = i + 2;
}
p1 = coords[lowerIndex];
p2 = coords[middleIndex];
p3 = coords[upperIndex];
area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
}
area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
}
return area;
}
function rad(_) {
return _ * Math.PI / 180;
}
});
// node_modules/circle-to-polygon/input-validation/validateCenter.js
var require_validateCenter = __commonJS((exports) => {
exports.validateCenter = function validateCenter(center) {
var validCenterLengths = [2, 3];
if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
throw new Error("ERROR! Center has to be an array of length two or three");
}
var [lng, lat] = center;
if (typeof lng !== "number" || typeof lat !== "number") {
throw new Error(`ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`);
}
if (lng > 180 || lng < -180) {
throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
}
if (lat > 90 || lat < -90) {
throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
}
};
});
// node_modules/circle-to-polygon/input-validation/validateRadius.js
var require_validateRadius = __commonJS((exports) => {
exports.validateRadius = function validateRadius(radius) {
if (typeof radius !== "number") {
throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
}
if (radius <= 0) {
throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
}
};
});
// node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
var require_validateNumberOfEdges = __commonJS((exports) => {
exports.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
if (typeof numberOfEdges !== "number") {
const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
}
if (numberOfEdges < 3) {
throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
}
};
});
// node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
var require_validateEarthRadius = __commonJS((exports) => {
exports.validateEarthRadius = function validateEarthRadius(earthRadius) {
if (typeof earthRadius !== "number") {
const ARGUMENT_TYPE = Array.isArray(earthRadius) ? "array" : typeof earthRadius;
throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
}
if (earthRadius <= 0) {
throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius}`);
}
};
});
// node_modules/circle-to-polygon/input-validation/validateBearing.js
var require_validateBearing = __commonJS((exports) => {
exports.validateBearing = function validateBearing(bearing) {
if (typeof bearing !== "number") {
const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
}
};
});
// node_modules/circle-to-polygon/input-validation/index.js
var require_input_validation = __commonJS((exports) => {
var validateCenter = require_validateCenter().validateCenter;
var validateRadius = require_validateRadius().validateRadius;
var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
var validateBearing = require_validateBearing().validateBearing;
function validateInput({ center, radius, numberOfEdges, earthRadius, bearing }) {
validateCenter(center);
validateRadius(radius);
validateNumberOfEdges(numberOfEdges);
validateEarthRadius(earthRadius);
validateBearing(bearing);
}
exports.validateCenter = validateCenter;
exports.validateRadius = validateRadius;
exports.validateNumberOfEdges = validateNumberOfEdges;
exports.validateEarthRadius = validateEarthRadius;
exports.validateBearing = validateBearing;
exports.validateInput = validateInput;
});
// node_modules/circle-to-polygon/index.js
var require_circle_to_polygon = __commonJS((exports, module) => {
var { validateInput } = require_input_validation();
var defaultEarthRadius = 6378137;
function toRadians(angleInDegrees) {
return angleInDegrees * Math.PI / 180;
}
function toDegrees(angleInRadians) {
return angleInRadians * 180 / Math.PI;
}
function offset(c1, distance, earthRadius, bearing) {
var lat1 = toRadians(c1[1]);
var lon1 = toRadians(c1[0]);
var dByR = distance / earthRadius;
var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing));
var lon = lon1 + Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat));
return [toDegrees(lon), toDegrees(lat)];
}
module.exports = function circleToPolygon(center, radius, options) {
var n = getNumberOfEdges(options);
var earthRadius = getEarthRadius(options);
var bearing = getBearing(options);
var direction = getDirection(options);
validateInput({ center, radius, numberOfEdges: n, earthRadius, bearing });
var start = toRadians(bearing);
var coordinates = [];
for (var i = 0;i < n; ++i) {
coordinates.push(offset(center, radius, earthRadius, start + direction * 2 * Math.PI * -i / n));
}
coordinates.push(coordinates[0]);
return {
type: "Polygon",
coordinates: [coordinates]
};
};
function getNumberOfEdges(options) {
if (isUndefinedOrNull(options)) {
return 32;
} else if (isObjectNotArray(options)) {
var numberOfEdges = options.numberOfEdges;
return numberOfEdges === undefined ? 32 : numberOfEdges;
}
return options;
}
function getEarthRadius(options) {
if (isUndefinedOrNull(options)) {
return defaultEarthRadius;
} else if (isObjectNotArray(options)) {
var earthRadius = options.earthRadius;
return earthRadius === undefined ? defaultEarthRadius : earthRadius;
}
return defaultEarthRadius;
}
function getDirection(options) {
if (isObjectNotArray(options) && options.rightHandRule) {
return -1;
}
return 1;
}
function getBearing(options) {
if (isUndefinedOrNull(options)) {
return 0;
} else if (isObjectNotArray(options)) {
var bearing = options.bearing;
return bearing === undefined ? 0 : bearing;
}
return 0;
}
function isObjectNotArray(argument) {
return argument !== null && typeof argument === "object" && !Array.isArray(argument);
}
function isUndefinedOrNull(argument) {
return argument === null || argument === undefined;
}
});
// node_modules/geojson-precision/index.js
var require_geojson_precision = __commonJS((exports, module) => {
(function() {
function parse(t, coordinatePrecision, extrasPrecision) {
function point(p) {
return p.map(function(e, index) {
if (index < 2) {
return 1 * e.toFixed(coordinatePrecision);
} else {
return 1 * e.toFixed(extrasPrecision);
}
});
}
function multi(l) {
return l.map(point);
}
function poly(p) {
return p.map(multi);
}
function multiPoly(m) {
return m.map(poly);
}
function geometry(obj) {
if (!obj) {
return {};
}
switch (obj.type) {
case "Point":
obj.coordinates = point(obj.coordinates);
return obj;
case "LineString":
case "MultiPoint":
obj.coordinates = multi(obj.coordinates);
return obj;
case "Polygon":
case "MultiLineString":
obj.coordinates = poly(obj.coordinates);
return obj;
case "MultiPolygon":
obj.coordinates = multiPoly(obj.coordinates);
return obj;
case "GeometryCollection":
obj.geometries = obj.geometries.map(geometry);
return obj;
default:
return {};
}
}
function feature2(obj) {
obj.geometry = geometry(obj.geometry);
return obj;
}
function featureCollection(f) {
f.features = f.features.map(feature2);
return f;
}
function geometryCollection(g) {
g.geometries = g.geometries.map(geometry);
return g;
}
if (!t) {
return t;
}
switch (t.type) {
case "Feature":
return feature2(t);
case "GeometryCollection":
return geometryCollection(t);
case "FeatureCollection":
return featureCollection(t);
case "Point":
case "LineString":
case "Polygon":
case "MultiPoint":
case "MultiPolygon":
case "MultiLineString":
return geometry(t);
default:
return t;
}
}
module.exports = parse;
module.exports.parse = parse;
})();
});
// src/index.ts
var exports_src = {};
__export(exports_src, {
default: () => src_default,
LocationConflation: () => LocationConflation
});
// node_modules/@rapideditor/country-coder/dist/country-coder.mjs
var import_which_polygon = __toESM(require_which_polygon(), 1);
var borders_default = {
type: "FeatureCollection",
features: [
{ type: "Feature", properties: { wikidata: "Q21", nameEn: "England", aliases: ["GB-ENG"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.03913, 51.13217], [-7.74976, 48.64773], [1.17405, 50.74239], [2.18458, 51.52087], [2.56575, 51.85301], [0.792, 57.56437], [-2.30613, 55.62698], [-2.17058, 55.45916], [-2.6095, 55.28488], [-2.63532, 55.19452], [-3.02906, 55.04606], [-3.09361, 54.94924], [-3.38407, 54.94278], [-4.1819, 54.57861], [-3.5082, 53.54318], [-3.08228, 53.25526], [-3.03675, 53.25092], [-2.92329, 53.19383], [-2.92022, 53.17685], [-2.98598, 53.15589], [-2.90649, 53.10964], [-2.87469, 53.12337], [-2.89131, 53.09374], [-2.83133, 52.99184], [-2.7251, 52.98389], [-2.72221, 52.92969], [-2.80549, 52.89428], [-2.85897, 52.94487], [-2.92401, 52.93836], [-2.97243, 52.9651], [-3.13576, 52.895], [-3.15744, 52.84947], [-3.16105, 52.79599], [-3.08734, 52.77504], [-3.01001, 52.76636], [-2.95581, 52.71794], [-3.01724, 52.72083], [-3.04398, 52.65435], [-3.13648, 52.58208], [-3.12926, 52.5286], [-3.09746, 52.53077], [-3.08662, 52.54811], [-3.00929, 52.57774], [-2.99701, 52.551], [-3.03603, 52.49969], [-3.13359, 52.49174], [-3.22971, 52.45344], [-3.22754, 52.42526], [-3.04687, 52.34504], [-2.95364, 52.3501], [-2.99701, 52.323], [-3.00785, 52.2753], [-3.09289, 52.20546], [-3.12638, 52.08114], [-2.97111, 51.90456], [-2.8818, 51.93196], [-2.78742, 51.88833], [-2.74277, 51.84367], [-2.66234, 51.83555], [-2.66336, 51.59504], [-3.20563, 51.31615], [-6.03913, 51.13217]]]] } },
{ type: "Feature", properties: { wikidata: "Q22", nameEn: "Scotland", aliases: ["GB-SCT"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.792, 57.56437], [-0.3751, 61.32236], [-14.78497, 57.60709], [-6.82333, 55.83103], [-4.69044, 54.3629], [-3.38407, 54.94278], [-3.09361, 54.94924], [-3.02906, 55.04606], [-2.63532, 55.19452], [-2.6095, 55.28488], [-2.17058, 55.45916], [-2.30613, 55.62698], [0.792, 57.56437]]]] } },
{ type: "Feature", properties: { wikidata: "Q25", nameEn: "Wales", aliases: ["GB-WLS"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.5082, 53.54318], [-5.37267, 53.63269], [-6.03913, 51.13217], [-3.20563, 51.31615], [-2.66336, 51.59504], [-2.66234, 51.83555], [-2.74277, 51.84367], [-2.78742, 51.88833], [-2.8818, 51.93196], [-2.97111, 51.90456], [-3.12638, 52.08114], [-3.09289, 52.20546], [-3.00785, 52.2753], [-2.99701, 52.323], [-2.95364, 52.3501], [-3.04687, 52.34504], [-3.22754, 52.42526], [-3.22971, 52.45344], [-3.13359, 52.49174], [-3.03603, 52.49969], [-2.99701, 52.551], [-3.00929, 52.57774], [-3.08662, 52.54811], [-3.09746, 52.53077], [-3.12926, 52.5286], [-3.13648, 52.58208], [-3.04398, 52.65435], [-3.01724, 52.72083], [-2.95581, 52.71794], [-3.01001, 52.76636], [-3.08734, 52.77504], [-3.16105, 52.79599], [-3.15744, 52.84947], [-3.13576, 52.895], [-2.97243, 52.9651], [-2.92401, 52.93836], [-2.85897, 52.94487], [-2.80549, 52.89428], [-2.72221, 52.92969], [-2.7251, 52.98389], [-2.83133, 52.99184], [-2.89131, 53.09374], [-2.87469, 53.12337], [-2.90649, 53.10964], [-2.98598, 53.15589], [-2.92022, 53.17685], [-2.92329, 53.19383], [-3.03675, 53.25092], [-3.08228, 53.25526], [-3.5082, 53.54318]]]] } },
{ type: "Feature", properties: { wikidata: "Q26", nameEn: "Northern Ireland", aliases: ["GB-NIR"], country: "GB", groups: ["Q22890", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.34755, 55.49206], [-7.2471, 55.06933], [-7.34464, 55.04688], [-7.4033, 55.00391], [-7.40004, 54.94498], [-7.44404, 54.9403], [-7.4473, 54.87003], [-7.47626, 54.83084], [-7.54508, 54.79401], [-7.54671, 54.74606], [-7.64449, 54.75265], [-7.75041, 54.7103], [-7.83352, 54.73854], [-7.93293, 54.66603], [-7.70315, 54.62077], [-7.8596, 54.53671], [-7.99812, 54.54427], [-8.04538, 54.48941], [-8.179, 54.46763], [-8.04555, 54.36292], [-7.87101, 54.29299], [-7.8596, 54.21779], [-7.81397, 54.20159], [-7.69501, 54.20731], [-7.55812, 54.12239], [-7.4799, 54.12239], [-7.44567, 54.1539], [-7.32834, 54.11475], [-7.30553, 54.11869], [-7.34005, 54.14698], [-7.29157, 54.17191], [-7.28017, 54.16714], [-7.29687, 54.1354], [-7.29493, 54.12013], [-7.26316, 54.13863], [-7.25012, 54.20063], [-7.14908, 54.22732], [-7.19145, 54.31296], [-7.02034, 54.4212], [-6.87775, 54.34682], [-6.85179, 54.29176], [-6.81583, 54.22791], [-6.74575, 54.18788], [-6.70175, 54.20218], [-6.6382, 54.17071], [-6.66264, 54.0666], [-6.62842, 54.03503], [-6.47849, 54.06947], [-6.36605, 54.07234], [-6.36279, 54.11248], [-6.32694, 54.09337], [-6.29003, 54.11278], [-6.26218, 54.09785], [-5.83481, 53.87749], [-4.69044, 54.3629], [-6.34755, 55.49206]]]] } },
{ type: "Feature", properties: { wikidata: "Q35", nameEn: "Denmark", country: "DK", groups: ["EU", "154", "150", "UN"], callingCodes: ["45"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.16597, 56.60205], [10.40861, 58.38489], [7.28637, 57.35913], [8.02459, 55.09613], [8.45719, 55.06747], [8.55769, 54.91837], [8.63979, 54.91069], [8.76387, 54.8948], [8.81178, 54.90518], [8.92795, 54.90452], [9.04629, 54.87249], [9.14275, 54.87421], [9.20571, 54.85841], [9.24631, 54.84726], [9.23445, 54.83432], [9.2474, 54.8112], [9.32771, 54.80602], [9.33849, 54.80233], [9.36496, 54.81749], [9.38532, 54.83968], [9.41213, 54.84254], [9.43155, 54.82586], [9.4659, 54.83131], [9.58937, 54.88785], [9.62734, 54.88057], [9.61187, 54.85548], [9.73563, 54.8247], [9.89314, 54.84171], [10.16755, 54.73883], [10.31111, 54.65968], [11.00303, 54.63689], [11.90309, 54.38543], [12.85844, 54.82438], [13.93395, 54.84044], [15.36991, 54.73263], [15.79951, 55.54655], [14.89259, 55.5623], [14.28399, 55.1553], [12.84405, 55.13257], [12.60345, 55.42675], [12.88472, 55.63369], [12.6372, 55.91371], [12.65312, 56.04345], [12.07466, 56.29488], [12.16597, 56.60205]]]] } },
{ type: "Feature", properties: { wikidata: "Q55", nameEn: "Netherlands", country: "NL", groups: ["EU", "155", "150", "UN"], callingCodes: ["31"] }, geometry: { type: "MultiPolygon", coordinates: [[[[5.45168, 54.20039], [2.56575, 51.85301], [3.36263, 51.37112], [3.38696, 51.33436], [3.35847, 51.31572], [3.38289, 51.27331], [3.41704, 51.25933], [3.43488, 51.24135], [3.52698, 51.2458], [3.51502, 51.28697], [3.58939, 51.30064], [3.78999, 51.25766], [3.78783, 51.2151], [3.90125, 51.20371], [3.97889, 51.22537], [4.01957, 51.24504], [4.05165, 51.24171], [4.16721, 51.29348], [4.24024, 51.35371], [4.21923, 51.37443], [4.33265, 51.37687], [4.34086, 51.35738], [4.39292, 51.35547], [4.43777, 51.36989], [4.38064, 51.41965], [4.39747, 51.43316], [4.38122, 51.44905], [4.47736, 51.4778], [4.5388, 51.48184], [4.54675, 51.47265], [4.52846, 51.45002], [4.53521, 51.4243], [4.57489, 51.4324], [4.65442, 51.42352], [4.72935, 51.48424], [4.74578, 51.48937], [4.77321, 51.50529], [4.78803, 51.50284], [4.84139, 51.4799], [4.82409, 51.44736], [4.82946, 51.4213], [4.78314, 51.43319], [4.76577, 51.43046], [4.77229, 51.41337], [4.78941, 51.41102], [4.84988, 51.41502], [4.90016, 51.41404], [4.92152, 51.39487], [5.00393, 51.44406], [5.0106, 51.47167], [5.03281, 51.48679], [5.04774, 51.47022], [5.07891, 51.4715], [5.10456, 51.43163], [5.07102, 51.39469], [5.13105, 51.34791], [5.13377, 51.31592], [5.16222, 51.31035], [5.2002, 51.32243], [5.24244, 51.30495], [5.22542, 51.26888], [5.23814, 51.26064], [5.26461, 51.26693], [5.29716, 51.26104], [5.33886, 51.26314], [5.347, 51.27502], [5.41672, 51.26248], [5.4407, 51.28169], [5.46519, 51.2849], [5.48476, 51.30053], [5.515, 51.29462], [5.5569, 51.26544], [5.5603, 51.22249], [5.65145, 51.19788], [5.65528, 51.18736], [5.70344, 51.1829], [5.74617, 51.18928], [5.77735, 51.17845], [5.77697, 51.1522], [5.82564, 51.16753], [5.85508, 51.14445], [5.80798, 51.11661], [5.8109, 51.10861], [5.83226, 51.10585], [5.82921, 51.09328], [5.79903, 51.09371], [5.79835, 51.05834], [5.77258, 51.06196], [5.75961, 51.03113], [5.77688, 51.02483], [5.76242, 50.99703], [5.71864, 50.96092], [5.72875, 50.95428], [5.74752, 50.96202], [5.75927, 50.95601], [5.74644, 50.94723], [5.72545, 50.92312], [5.72644, 50.91167], [5.71626, 50.90796], [5.69858, 50.91046], [5.67886, 50.88142], [5.64504, 50.87107], [5.64009, 50.84742], [5.65259, 50.82309], [5.70118, 50.80764], [5.68995, 50.79641], [5.70107, 50.7827], [5.68091, 50.75804], [5.69469, 50.75529], [5.72216, 50.76398], [5.73904, 50.75674], [5.74356, 50.7691], [5.76533, 50.78159], [5.77513, 50.78308], [5.80673, 50.7558], [5.84548, 50.76542], [5.84888, 50.75448], [5.88734, 50.77092], [5.89129, 50.75125], [5.89132, 50.75124], [5.95942, 50.7622], [5.97545, 50.75441], [6.01976, 50.75398], [6.02624, 50.77453], [5.97497, 50.79992], [5.98404, 50.80988], [6.00462, 50.80065], [6.02328, 50.81694], [6.01921, 50.84435], [6.05623, 50.8572], [6.05702, 50.85179], [6.07431, 50.84674], [6.07693, 50.86025], [6.08805, 50.87223], [6.07486, 50.89307], [6.09297, 50.92066], [6.01615, 50.93367], [6.02697, 50.98303], [5.95282, 50.98728], [5.90296, 50.97356], [5.90493, 51.00198], [5.87849, 51.01969], [5.86735, 51.05182], [5.9134, 51.06736], [5.9541, 51.03496], [5.98292, 51.07469], [6.16706, 51.15677], [6.17384, 51.19589], [6.07889, 51.17038], [6.07889, 51.24432], [6.16977, 51.33169], [6.22674, 51.36135], [6.22641, 51.39948], [6.20654, 51.40049], [6.21724, 51.48568], [6.18017, 51.54096], [6.09055, 51.60564], [6.11759, 51.65609], [6.02767, 51.6742], [6.04091, 51.71821], [5.95003, 51.7493], [5.98665, 51.76944], [5.94568, 51.82786], [5.99848, 51.83195], [6.06705, 51.86136], [6.10337, 51.84829], [6.16902, 51.84094], [6.11551, 51.89769], [6.15349, 51.90439], [6.21443, 51.86801], [6.29872, 51.86801], [6.30593, 51.84998], [6.40704, 51.82771], [6.38815, 51.87257], [6.47179, 51.85395], [6.50231, 51.86313], [6.58556, 51.89386], [6.68386, 51.91861], [6.72319, 51.89518], [6.82357, 51.96711], [6.83035, 51.9905], [6.68128, 52.05052], [6.76117, 52.11895], [6.83984, 52.11728], [6.97189, 52.20329], [6.9897, 52.2271], [7.03729, 52.22695], [7.06365, 52.23789], [7.02703, 52.27941], [7.07044, 52.37805], [7.03417, 52.40237], [6.99041, 52.47235], [6.94293, 52.43597], [6.69507, 52.488], [6.71641, 52.62905], [6.77307, 52.65375], [7.04557, 52.63318], [7.07253, 52.81083], [7.21694, 53.00742], [7.17898, 53.13817], [7.22681, 53.18165], [7.21679, 53.20058], [7.19052, 53.31866], [7.00198, 53.32672], [6.91025, 53.44221], [5.45168, 54.20039]], [[4.93295, 51.44945], [4.95244, 51.45207], [4.9524, 51.45014], [4.93909, 51.44632], [4.93295, 51.44945]], [[4.91493, 51.4353], [4.91935, 51.43634], [4.92227, 51.44252], [4.91811, 51.44621], [4.92287, 51.44741], [4.92811, 51.4437], [4.92566, 51.44273], [4.92815, 51.43856], [4.92879, 51.44161], [4.93544, 51.44634], [4.94025, 51.44193], [4.93416, 51.44185], [4.93471, 51.43861], [4.94265, 51.44003], [4.93986, 51.43064], [4.92952, 51.42984], [4.92652, 51.43329], [4.91493, 51.4353]]]] } },
{ type: "Feature", properties: { wikidata: "Q782", nameEn: "Hawaii", aliases: ["US-HI"], country: "US", groups: ["Q35657", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.8563, 29.18961], [-179.49839, 27.86265], [-151.6784, 9.55515], [-154.05867, 45.51124], [-177.5224, 27.7635], [-177.8563, 29.18961]]]] } },
{ type: "Feature", properties: { wikidata: "Q797", nameEn: "Alaska", aliases: ["US-AK"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.34848, 52.47228], [180, 51.0171], [179.84401, 55.10087], [169.34848, 52.47228]]], [[[-168.95635, 65.98512], [-169.03888, 65.48473], [-172.76104, 63.77445], [-179.55295, 57.62081], [-179.55295, 50.81807], [-133.92876, 54.62289], [-130.61931, 54.70835], [-130.64499, 54.76912], [-130.44184, 54.85377], [-130.27203, 54.97174], [-130.18765, 55.07744], [-130.08035, 55.21556], [-129.97513, 55.28029], [-130.15373, 55.74895], [-130.00857, 55.91344], [-130.00093, 56.00325], [-130.10173, 56.12178], [-130.33965, 56.10849], [-130.77769, 56.36185], [-131.8271, 56.62247], [-133.38523, 58.42773], [-133.84645, 58.73543], [-134.27175, 58.8634], [-134.48059, 59.13231], [-134.55699, 59.1297], [-134.7047, 59.2458], [-135.00267, 59.28745], [-135.03069, 59.56208], [-135.48007, 59.79937], [-136.31566, 59.59083], [-136.22381, 59.55526], [-136.33727, 59.44466], [-136.47323, 59.46617], [-136.52365, 59.16752], [-136.82619, 59.16198], [-137.4925, 58.89415], [-137.60623, 59.24465], [-138.62145, 59.76431], [-138.71149, 59.90728], [-139.05365, 59.99655], [-139.20603, 60.08896], [-139.05831, 60.35205], [-139.68991, 60.33693], [-139.98024, 60.18027], [-140.45648, 60.30919], [-140.5227, 60.22077], [-141.00116, 60.30648], [-140.97446, 84.39275], [-168.25765, 71.99091], [-168.95635, 65.98512]]]] } },
{ type: "Feature", properties: { wikidata: "Q3492", nameEn: "Sumatra", aliases: ["ID-SM"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.82788, 2.86812], [110.90339, 7.52694], [105.01437, 3.24936], [104.56723, 1.44271], [104.34728, 1.33529], [104.12282, 1.27714], [104.03085, 1.26954], [103.74084, 1.12902], [103.66049, 1.18825], [103.56591, 1.19719], [103.03657, 1.30383], [96.11174, 6.69841], [74.28481, -3.17525], [102.92489, -8.17146], [106.32259, -5.50116], [106.38511, -5.16715], [109.17017, -4.07401], [109.3962, -2.07276], [108.50935, -2.01066], [107.94791, 1.06924], [109.82788, 2.86812]]]] } },
{ type: "Feature", properties: { wikidata: "Q3757", nameEn: "Java", aliases: ["ID-JW"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, g