Improved version of geo_s2sparse.js