function isInBbox(position, bbox) { if(position.lat > bbox.top || position.lat < bbox.bottom) return false; if(bbox.right < bbox.left) // bbox spans over lon = 180 return (position.lon > bbox.left || position.lon < bbox.right); else return (position.lon > bbox.left && position.lon < bbox.right); } module.exports = { isInBbox : isInBbox };