function(lat, lng, radius, level) {
        if (typeof radius === 'undefined') radius = 3;
        if (typeof level === 'undefined') level = 15;

        /* eslint-disable new-cap */
        var origin = s2.S2Cell.FromLatLng({
            lat: lat,
            lng: lng
        }, level);
        var cells = [];

        cells.push(origin.toHilbertQuadkey()); // middle block

        for (var i = 1; i < radius; i++) {
            // cross in middle
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0], origin.ij[1] - i], origin.level)
                .toHilbertQuadkey());
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0], origin.ij[1] + i], origin.level)
                .toHilbertQuadkey());
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] - i, origin.ij[1]], origin.level)
                .toHilbertQuadkey());
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] + i, origin.ij[1]], origin.level)
                .toHilbertQuadkey());

            for (var j = 1; j < radius; j++) {
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] - j, origin.ij[1] - i], origin.level)
                    .toHilbertQuadkey());
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] + j, origin.ij[1] - i], origin.level)
                    .toHilbertQuadkey());
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] - j, origin.ij[1] + i], origin.level)
                    .toHilbertQuadkey());
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] + j, origin.ij[1] + i], origin.level)
                    .toHilbertQuadkey());
            }
        }
        /* eslint-enable new-cap */

        return cells.map(s2.toId);
    }
function(lat, lng, radius, level) {
        if (typeof radius === 'undefined') radius = 3;
        if (typeof level === 'undefined') level = 15;

        /* eslint-disable new-cap */
        var origin = s2.S2Cell.FromLatLng({
            lat: lat,
            lng: lng
        }, level);
        var cells = [];

        cells.push(origin.toHilbertQuadkey()); // middle block

        for (var i = 1; i < radius; i++) {
            // cross in middle
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0], origin.ij[1] - i], origin.level)
                .toHilbertQuadkey());
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0], origin.ij[1] + i], origin.level)
                .toHilbertQuadkey());
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] - i, origin.ij[1]], origin.level)
                .toHilbertQuadkey());
            cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] + i, origin.ij[1]], origin.level)
                .toHilbertQuadkey());

            for (var j = 1; j < radius; j++) {
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] - j, origin.ij[1] - i], origin.level)
                    .toHilbertQuadkey());
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] + j, origin.ij[1] - i], origin.level)
                    .toHilbertQuadkey());
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] - j, origin.ij[1] + i], origin.level)
                    .toHilbertQuadkey());
                cells.push(s2.S2Cell.FromFaceIJ(origin.face, [origin.ij[0] + j, origin.ij[1] + i], origin.level)
                    .toHilbertQuadkey());
            }
        }
        /* eslint-enable new-cap */

        return cells.map(s2.toId);
    }
function ( lat , lng , radius , level ) { if ( typeof radius === 'undefined' ) radius = 3 ; if ( typeof level === 'undefined' ) level = 15 ; /* eslint-disable new-cap */ var origin = s2 . S2Cell . FromLatLng ( { lat : lat , lng : lng } , level ) ; var cells = [ ] ; cells . push ( origin . toHilbertQuadkey ( ) ) ; // middle block for ( var i = 1 ; i < radius ; i ++ ) { // cross in middle cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] , origin . ij [ 1 ] - i ] , origin . level ) . toHilbertQuadkey ( ) ) ; cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] , origin . ij [ 1 ] + i ] , origin . level ) . toHilbertQuadkey ( ) ) ; cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] - i , origin . ij [ 1 ] ] , origin . level ) . toHilbertQuadkey ( ) ) ; cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] + i , origin . ij [ 1 ] ] , origin . level ) . toHilbertQuadkey ( ) ) ; for ( var j = 1 ; j < radius ; j ++ ) { cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] - j , origin . ij [ 1 ] - i ] , origin . level ) . toHilbertQuadkey ( ) ) ; cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] + j , origin . ij [ 1 ] - i ] , origin . level ) . toHilbertQuadkey ( ) ) ; cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] - j , origin . ij [ 1 ] + i ] , origin . level ) . toHilbertQuadkey ( ) ) ; cells . push ( s2 . S2Cell . FromFaceIJ ( origin . face , [ origin . ij [ 0 ] + j , origin . ij [ 1 ] + i ] , origin . level ) . toHilbertQuadkey ( ) ) ; } } /* eslint-enable new-cap */ return cells . map ( s2 . toId ) ; }
Provides cell IDs of nearby cells based on the given coords and radius
@param {number} lat
@param {number} lng
@param {number} [radius=3]
@param {number} [level=15]
@returns {array}
@static
Provides cell IDs of nearby cells based on the given coords and radius