Bug 29460 - GPSDictionary doesn't save data properly
Summary: GPSDictionary doesn't save data properly
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-04-28 09:12 UTC by jpbugzilla
Modified: 2015-04-29 12:28 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description jpbugzilla 2015-04-28 09:12:27 UTC
I am using trying to add GPS data to a tiff image I'm saving. Upon analyzing the resulting image, I am only getting the Latitude and in the image. The GPSDateStamp and GPSTimeStamp are saving properly as well.

gpsDict.SetValueForKey(NSObject.FromObject(location.Latitude.Value), ImageIO.CGImageProperties.GPSLatitude);
gpsDict.SetValueForKey(NSObject.FromObject(location.Latitude.Value > 0 ? "N" : "S"), ImageIO.CGImageProperties.GPSLatitudeRef);
gpsDict.SetValueForKey(NSObject.FromObject(location.Longitude.Value), ImageIO.CGImageProperties.GPSLongitude);
gpsDict.SetValueForKey(NSObject.FromObject(location.Longitude.Value > 0 ? "E" : "W"), ImageIO.CGImageProperties.GPSLongitudeRef);
gpsDict.SetValueForKey(NSObject.FromObject(location.Timestamp.Value.ToShortDateString()), ImageIO.CGImageProperties.GPSDateStamp);
gpsDict.SetValueForKey(NSObject.FromObject(location.Timestamp.Value.ToString("HH:MM:ss.ff")), ImageIO.CGImageProperties.GPSTimeStamp);
imageMetadata.SetValueForKey (gpsDict as NSDictionary, ImageIO.CGImageProperties.GPSDictionary);

I then use the imageMetadata when I save the image and I'm getting everything except the Longitude.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-04-28 09:31:20 UTC
Could you attach a complete project (with a sample tiff image) we can use to reproduce this?
Comment 2 jpbugzilla 2015-04-29 12:22:59 UTC
Upon further investigation, I have discovered that the longitude must be saved in positive number only. I added an Abs to the value for both Lat and Lon and I am now getting the expected result.
Comment 3 jpbugzilla 2015-04-29 12:28:45 UTC
I suppose I could suggest that some kind of error be generated rather than allowing a malformed image header. That is why this was so difficult to troubleshoot.