Beispiel #1
0
        /// <summary>
        /// Read the location metadata from an image file
        /// </summary>
        /// <returns>A list of double values, the first element is latitude, the second is longitude</returns>
        public async static Task<SurveyPhoto> ReadImageMetaData(StorageFile file)
        {
            var requests = new List<string> { "System.GPS.Latitude", "System.GPS.Longitude", "System.Comment", "System.Photo.DateTaken" };
            var retrievedProps = await file.Properties.RetrievePropertiesAsync(requests);
            var res = new SurveyPhoto {ResourceName = file.Name};

            foreach (var request in requests.Where(retrievedProps.ContainsKey))
            {
                switch (request)
                {
                    case "System.GPS.Latitude":
                        res.Latitude = CoordIntArrayToDouble(retrievedProps[request] as double[]); break;
                    case "System.GPS.Longitude":
                        res.Longitude = -CoordIntArrayToDouble(retrievedProps[request] as double[]); break;
                    case "System.Photo.DateTaken":
                        res.TimeTaken = ((DateTimeOffset)retrievedProps[request]).DateTime; break;
                    case "System.Comment":
                    default:
                        res.SegmentSurveyId = retrievedProps[request] as string; break;
                }
            }
            return res;
        }
Beispiel #2
0
 public SurveyPhotoWrapper(StorageFile file)
 {
     this.File = file;
     SurveyPhoto = new SurveyPhoto();
 }