Find the closest point in db to pos.
    :returns: Closest dataset as well as the distance in meters.

def find_closest(db, pos):
    """Find the closest point in db to pos.
    :returns: Closest dataset as well as the distance in meters.
    """
    def get_dist(d1, d2):
        """Get distance between d1 and d2 in meters."""
        lat1, lon1 = d1['latitude'], d1['longitude']
        lat2, lon2 = d2['latitude'], d2['longitude']
        R = 6371000.0  # metres
        phi1 = math.radians(lat1)
        phi2 = math.radians(lat2)
        delta_phi = math.radians(lat2-lat1)
        delta_delta = math.radians(lon2-lon1)

        a = math.sin(delta_phi/2) * math.sin(delta_phi/2) + \
            math.cos(phi1) * math.cos(phi2) * \
            math.sin(delta_delta/2) * math.sin(delta_delta/2)
        c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))

        d = R * c
        return d
    closest_dataset, closest_dist = db[0], get_dist(pos, db[0])
    for dataset in db:
        dist = get_dist(pos, dataset)
        if dist < closest_dist:
            closest_dataset = dataset
            closest_dist = dist
    return closest_dataset, closest_dist