Esempio n. 1
0
        public short GetElevation(double latitude, double longitude)
        {
            var tile = _tiles.FirstOrDefault(t => t.Contains(latitude, longitude));

            if (tile == null)
            {
                return(0);
            }

            var elevationMap = TiffTools.GetElevationMap(_directory, tile);

            return(tile.GetElevation(latitude, longitude, elevationMap));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            double latitude;
            double longitude;

            if (args.Length < 2 || !double.TryParse(args[0], out latitude) || !double.TryParse(args[1], out longitude))
            {
#if DEBUG
                //Mont Blanc
                latitude  = 45.832627;
                longitude = 6.864717;
#else
                Console.WriteLine("SrtmSandBox.exe [latitude] [longitude]");
                return;
#endif
            }

            var dir         = new DirectoryInfo(dirPath);
            var allTiles    = TiffTools.GetDirectoryTiles(dir).ToArray();
            var tileManager = new TileManager(dir, allTiles);
            Console.WriteLine(tileManager.GetElevation(latitude, longitude));
        }