geocoded = {
const jitter = function([long, lat]) {
const theta = Math.random() * 6.28
const r = Math.sqrt(1 - Math.random()) * .1
return [long + Math.sin(theta) * r, lat + .65 * Math.cos(theta) * r]
}
const features = []
let i = 0;
for (let {url, ip, status} of wider) {
const point = geocode(ip)
if (!point.lat) {
continue
}
const datum = {
type: "Feature",
geometry: {
type: "Point",
coordinates: jitter([point.long, point.lat])
},
id: i++,
properties: {
ip, url, place: geocode.place, status, match: url.match(search), troubled : troubled.has(url) ? 1 : 0
}
}
features.push(datum)
}
return {
type: "FeatureCollection",
features
}
}