首页 > 其他 > 详细

ArcGIS Pro二次开发-获得一个栅格

时间:2020-03-12 12:55:56      阅读:65      评论:0      收藏:0      [点我收藏+]
/// <summary>

        /// Open a Raster Dataset given a folder and a dataset name.

        /// </summary>

        /// <param name="folder">Full path to the folder containing the raster dataset.</param>

        /// <param name="name">Name of the raster dataset to open.</param>

        /// <returns></returns>

        public static RasterDataset OpenRasterDataset(string folder, string name)

        {

            // Create a new raster dataset which is set to null

            RasterDataset rasterDatasetToOpen = null;

            try

            {

                // Create a new file system connection path to open raster datasets using the folder path.

                FileSystemConnectionPath connectionPath = new FileSystemConnectionPath(new System.Uri(folder), FileSystemDatastoreType.Raster);

                // Create a new file system data store for the connection path created above.

                FileSystemDatastore dataStore = new FileSystemDatastore(connectionPath);

                // Open the raster dataset.

                rasterDatasetToOpen = dataStore.OpenDataset<RasterDataset>(name);

                // Check if it is not null. If it is show a message box with the appropriate message.

                if (rasterDatasetToOpen == null)

                    MessageBox.Show("Failed to open raster dataset: " + name);

            }

            catch (Exception exc)

            {

                // If an exception occurs, show a message box with the appropriate message.

                MessageBox.Show("Exception caught in OpenRasterDataset for raster: " + name + exc.Message);

            }

            return rasterDatasetToOpen;

        }

 

ArcGIS Pro二次开发-获得一个栅格

原文:https://www.cnblogs.com/gisoracle/p/12467949.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!