예제 #1
0
        public async Task <SpatialDataSet> LoadDatasetFromResource(Uri uri)
        {
            var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);

            if (file != null)
            {
                using (var fileStream = await file.OpenStreamForReadAsync())
                {
                    //Read the spatial data file
                    var reader = new GeoJsonFeed();
                    return(await reader.ReadAsync(fileStream));
                }
            }
            return(null);
        }
예제 #2
0
        /// <summary>
        /// Not currently used
        /// </summary>
        /// <returns></returns>
        public async Task <SpatialDataSet> LoadDatasetFromFileSystem()
        {
            //Create a FileOpenPicker to allow the user to select which file to import
            var openPicker = new FileOpenPicker()
            {
                ViewMode = PickerViewMode.List,
                SuggestedStartLocation = PickerLocationId.Desktop
            };

            openPicker.FileTypeFilter.Add(".json");

            var file = await openPicker.PickSingleFileAsync();

            if (file != null)
            {
                using (var fileStream = await file.OpenStreamForReadAsync())
                {
                    //Read the spatial data file
                    var reader = new GeoJsonFeed();
                    return(await reader.ReadAsync(fileStream));
                }
            }
            return(null);
        }