Ejemplo n.º 1
0
        const string base32 = "0123456789bcdefghjkmnpqrstuvwxyz"; // (geohash-specific) Base32 map


        /**
         * Returns all 8 adjacent cells to specified geohash.
         *
         * @param   {string} geohash - Geohash neighbours are required of.
         * @returns {{n,ne,e,se,s,sw,w,nw: string}}
         * @throws  Invalid geohash.
         */
        public static GeocodeMatrix Neighbours(string code)
        {
            return(GeocodeMatrix.Create(code)
                   .Add(adjacent(code, Direction.N))
                   .Add(adjacent(adjacent(code, Direction.N), Direction.E))
                   .Add(adjacent(code, Direction.E))
                   .Add(adjacent(adjacent(code, Direction.S), Direction.E))
                   .Add(adjacent(code, Direction.S))
                   .Add(adjacent(adjacent(code, Direction.S), Direction.W))
                   .Add(adjacent(code, Direction.W))
                   .Add(adjacent(adjacent(code, Direction.N), Direction.W)));
        }
Ejemplo n.º 2
0
 public bool Exists(GeocodeMatrix matrix) => matrices.Exists(matrix);
Ejemplo n.º 3
0
 public void Add(GeocodeMatrix matrix) => matrices.Add(matrix);
Ejemplo n.º 4
0
 public IEnumerable <string> f(GeocodeMatrix m) => m.Neighbours().Select(x => x.Code);