
cocoaslideshow - issue #4
Google Map Display don't understand Western/Southern Hemisphere
What steps will reproduce the problem? 1. Get a geotagged photo from the Western Hemisphere (eg from the USA) 2. Bring up the Google Map Display 3. Ahhhhhh - we're in Japan!
What is the expected output? To be in the USA (120W) What do you see instead? We're in Japan (120E)
What version of the product are you using? On what operating system? app:0.5 OS 10.5.6
Please provide any additional information below.
Here's my fix - I'm sure there are other good (better) fixes.
- (NSString )gmapMarkerWithIndex:(int)index
{
NSString result = nil;
NSString* latitude = nil;
NSString* longitude = nil;
NSString* latitudeRef = nil;
NSString* longitudeRef = nil;
NSDictionary* gps = [self gps];
// get the geotag strings
if( gps ) {
latitude = [gps objectForKey:(NSString *)kCGImagePropertyGPSLatitude];
longitude = [gps objectForKey:(NSString *)kCGImagePropertyGPSLongitude];
latitudeRef = [gps objectForKey:(NSString *)kCGImagePropertyGPSLatitudeRef];
longitudeRef = [gps objectForKey:(NSString *)kCGImagePropertyGPSLongitudeRef];
}
// convert geotags to double and format a JavaScript program for the browser to execute
if( latitude != nil && longitude != nil ) {
NSString *marker = [NSString stringWithFormat:@"marker%d", index];
double lat = [latitude doubleValue] ;
double lon = [longitude doubleValue];
if ( [latitudeRef isEqualToString:@"S"] ) lat *= -1 ;
if ( [longitudeRef isEqualToString:@"W"] ) lon *= -1 ;
result = [NSString stringWithFormat:@"\nvar %@ = new GMarker(new GLatLng(%0.3f,%0.3f), {title:
\"test\"});\n \ map.addOverlay(%@);\n \ bounds.extend(%@.getLatLng());\n\n", marker, lat, lon, marker, marker, marker, marker];
}
// cleanup
[latitudeRef release];
[longitudeRef release];
[latitude release];
[longitude release];
[gps release];
return result ;
} // I'm not to confident about the release - I'm new to Cocoa and still puzzled by the object life management.
Comment #1
Posted on Jan 11, 2009 by Massive CatThank you for this report. Could you please attach an image so that I can reproduce the bug?
Comment #2
Posted on Mar 4, 2009 by Massive CatI guess that the oldest versions of iPhone SDK did invert the longitude.
The problem is solved for latest pictures (at least since SDK 2.0) so I close this bug since I believe the coordinates handling is correct.
Comment #3
Posted on Apr 9, 2009 by Happy RhinoHi Nicolas
You've made a good job here - Congratulations.
I've attached a photograph taken in the Grand Canyon, AZ, USA. Your product's taking us on Google Maps to China! I'm using Version 0.5.1 (2009- 03-04 (110)).
Mind you, Preview shows the photo location near Flagstaff, AZ - about 100 miles from where the photo was taken.
I would rebuild from source, however I'm having trouble pulling down the code (subcommander crashed) and the command-line said:
528 /Users/rmills/temp/slides> svn checkout http://cocoaslideshow.googlecode.com/svn/trunk/ cocoaslideshow-read-only svn: Unrecognized URL scheme for 'http://cocoaslideshow.googlecode.com/svn/trunk' 529 /Users/rmills/temp/slides>
Ah, some days you can't win. Anyway, I hope you'll be able to reproduce the issue with the attached file.
Thanks
Robin
- Awesome view.jpg 2.38MB
Status: WontFix
Labels:
Type-Defect
Priority-Medium