예제 #1
0
        private string DumpRedirectMap()
        {
            var b         = new StringBuilder();
            var delimiter = ";";
            var hasher    = new GvtkGeohasher();

            b.Append("from;to;p_from;p_to;edge;bb_from;bb_to");
            b.Append(Environment.NewLine);
            foreach (var kvp in RedirectMap
                     .ToList()                                                    // Avoid thread errors
                     .Where(kvp => kvp.Key != kvp.Value))
            {
                b.Append(kvp.Key + delimiter);
                b.Append(kvp.Value + delimiter);
                b.Append(hasher.Decode(kvp.Key).AsText() + delimiter);
                b.Append(hasher.Decode(kvp.Value).AsText() + delimiter);
                b.Append(new LineString(new Coordinate[] { hasher.Decode(kvp.Key).Coordinate, hasher.Decode(kvp.Value).Coordinate }).AsText() + delimiter);
                b.Append(hasher.BoundingBox(kvp.Key).AsText() + delimiter);
                b.Append(hasher.BoundingBox(kvp.Value).AsText() + delimiter);
                b.Append(Environment.NewLine);
            }
            return(b.ToString());
        }
예제 #2
0
        private string DumpDeadDogs()
        {
            var b         = new StringBuilder();
            var delimiter = ";";
            var hasher    = new GvtkGeohasher();

            b.Append("timestamp;dog;p;bb");
            b.Append(Environment.NewLine);
            foreach (var dog in DeadDogs)
            {
                var timestamp = Util.DateTimeFromEpoch(long.Parse(dog.Split('-')[0]));
                var dogHash   = dog.Split('-')[1];

                b.Append(dogHash + delimiter);
                b.Append(timestamp.ToString("u") + delimiter);
                b.Append(hasher.Decode(dogHash).AsText() + delimiter);
                b.Append(hasher.BoundingBox(dogHash).AsText() + delimiter);
                b.Append(Environment.NewLine);
            }

            return(b.ToString());
        }