コード例 #1
0
        static void Main(string[] args)
        {
            String demDataFolder = @"D:\\Code\\Projects\\DEMData\\";

            IHgtFileNameParser fileNameParser = new HgtFileNameParser();
            IHgtByteConverter byteConverter = new HgtByteConverter();
            IAzureFileStorageShareProvider azureStorageProvider = new AzureFileStorageShareProvider(
                System.Configuration.ConfigurationManager.AppSettings["StorageConnectionString"],
                "hgt");

            IElevationFileReader elevationFileReader = new LocalFileStorageHgtElevationFileReader(fileNameParser, byteConverter);
            IElevationFileReader azureFileReader = new AzureFileStorageHgtElevationFileReader(fileNameParser, byteConverter,  azureStorageProvider);

            CloudFileDirectory cloudDirectoryRoot = azureStorageProvider.GetCloudFileShare().GetRootDirectoryReference();

            IElevationDataSet azureTestSet = azureFileReader.LoadDataSet(
                Path.Combine(cloudDirectoryRoot.Uri.ToString(), "N48E000.hgt"));

            IElevationDataSetRepository dataSetRepository = new ElevationDataSetFileSystemRepository(
                azureFileReader,
                fileNameParser,
                demDataFolder);

            IElevationDataManager elevationDataManager = new ElevationDataManager(dataSetRepository);

            DecimalGeoCoordinate testCoordinate = new DecimalGeoCoordinate(54.5, -2.5);

            int elevation;

            if (elevationDataManager.IsElevationDataSetAvailable(testCoordinate))
                elevation = elevationDataManager.GetElevationAtCoordinate(testCoordinate);

            IElevationProfiler elevationProfiler = new ElevationProfiler(
                elevationDataManager,
                new SimplePathPlotter());               // Used to draw the line by the elevation profiler

            IElevationProfile elevationProfile = elevationProfiler.GetElevationProfile(
                new DecimalGeoCoordinate(55.1, -2.1),   // Start of line
                new DecimalGeoCoordinate(55.2, -2.2),   // End of line
                100);                                   // Number of segments or 'resolution' of the profile

            IElevationProfile elevationProfile2 = elevationProfiler.GetElevationProfile(
                new List<DecimalGeoCoordinate>() { new DecimalGeoCoordinate(52, -1), new DecimalGeoCoordinate(52.2, -1.2), new DecimalGeoCoordinate(52.2, -1.4) }, 10);

            foreach (ElevationDataPoint point in elevationProfile.Points)
                Console.WriteLine("{0} {1}", point.Coordinates, point.ElevationInMetres);

            Console.ReadKey();
        }
コード例 #2
0
        /// <summary>
        /// Create an elevation reader for the azure file storage
        /// </summary>
        /// <returns></returns>
        private static IElevationFileReader GetAzureStorageElevationFileReader()
        {
            IHgtFileNameParser fileNameParser = new HgtFileNameParser();
            IHgtByteConverter byteConverter = new HgtByteConverter();
            IAzureFileStorageShareProvider azureStorageProvider = new AzureFileStorageShareProvider(
                ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString,
                "hgt");

            return new AzureFileStorageHgtElevationFileReader(fileNameParser, byteConverter, azureStorageProvider);
        }