function bounds(geohash) {
      if (geohash.length == 0) throw new Error('Invalid geohash');
      geohash = geohash.toLowerCase();
      var evenBit = true;
      var latMin = -90,
          latMax = 90;
      var lonMin = -180,
          lonMax = 180;

      for (var i = 0; i < geohash.length; i++) {
        var chr = geohash.charAt(i);
        var idx = this.$data.base32.indexOf(chr);
        if (idx == -1) throw new Error('Invalid geohash');

        for (var n = 4; n >= 0; n--) {
          var bitN = idx >> n & 1;

          if (evenBit) {
            // longitude
            var lonMid = (lonMin + lonMax) / 2;

            if (bitN == 1) {
              lonMin = lonMid;
            } else {
              lonMax = lonMid;
            }
          } else {
            // latitude
            var latMid = (latMin + latMax) / 2;

            if (bitN == 1) {
              latMin = latMid;
            } else {
              latMax = latMid;
            }
          }

          evenBit = !evenBit;
        }
      }

      var bounds = {
        sw: {
          lat: latMin,
          lon: lonMin
        },
        ne: {
          lat: latMax,
          lon: lonMax
        }
      };
      return bounds;
    }
/**
     * Returns SW/NE latitude/longitude bounds of specified geohash.
     *
     * @param   {string} geohash - Cell that bounds are required of.
     * @returns {{sw: {lat: number, lon: number}, ne: {lat: number, lon: number}}}
     * @throws  Invalid geohash.
     */
Returns SW/NE latitude/longitude bounds of specified geohash.
@param   {string} geohash - Cell that bounds are required of.
Returns SW / NE latitude / longitude bounds of specified geohash . @param { string } geohash - Cell that bounds are required of .
function bounds(geohash) {
      if (geohash.length == 0) throw new Error('Invalid geohash');
      geohash = geohash.toLowerCase();
      var evenBit = true;
      var latMin = -90,
          latMax = 90;
      var lonMin = -180,
          lonMax = 180;
      for (var i = 0; i < geohash.length; i++) {
        var chr = geohash.charAt(i);
        var idx = this.$data.base32.indexOf(chr);
        if (idx == -1) throw new Error('Invalid geohash');
        for (var n = 4; n >= 0; n--) {
          var bitN = idx >> n & 1;
          if (evenBit) {
            var lonMid = (lonMin + lonMax) / 2;
            if (bitN == 1) {
              lonMin = lonMid;
            } else {
              lonMax = lonMid;
            }
          } else {
            var latMid = (latMin + latMax) / 2;
            if (bitN == 1) {
              latMin = latMid;
            } else {
              latMax = latMid;
            }
          }
          evenBit = !evenBit;
        }
      }
      var bounds = {
        sw: {
          lat: latMin,
          lon: lonMin
        },
        ne: {
          lat: latMax,
          lon: lonMax
        }
      };
      return bounds;
    }
function bounds ( geohash ) { if ( geohash . length == 0 ) throw new Error ( 'Invalid geohash' ) ; geohash = geohash . toLowerCase ( ) ; var evenBit = true ; var latMin = - 90 , latMax = 90 ; var lonMin = - 180 , lonMax = 180 ; for ( var i = 0 ; i < geohash . length ; i ++ ) { var chr = geohash . charAt ( i ) ; var idx = this . $data . base32 . indexOf ( chr ) ; if ( idx == - 1 ) throw new Error ( 'Invalid geohash' ) ; for ( var n = 4 ; n >= 0 ; n -- ) { var bitN = idx >> n & 1 ; if ( evenBit ) { var lonMid = ( lonMin + lonMax ) / 2 ; if ( bitN == 1 ) { lonMin = lonMid ; } else { lonMax = lonMid ; } } else { var latMid = ( latMin + latMax ) / 2 ; if ( bitN == 1 ) { latMin = latMid ; } else { latMax = latMid ; } } evenBit = ! evenBit ; } } var bounds = { sw : { lat : latMin , lon : lonMin } , ne : { lat : latMax , lon : lonMax } } ; return bounds ; }
Returns SW/NE latitude/longitude bounds of specified geohash.
Returns SW / NE latitude / longitude bounds of specified geohash .
// longitude // latitude