This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 118 - Pages: 8 [ 1 2 3 4 5 | Next ] - Last Post: 28-Oct-2017 19:07 Last Post By: AndreWolff Threads: [ Previous | Next ]
AndreWolff

Posts: 2,154
Registered: 14-Dec-2007
Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 19:12
 
  Click to reply to this thread Reply
Enclosed picture contains the next GPS coordinates:

53.010414°, 4.710730° or 53°0'37" N 4°42'38" E

You see this info if you opens the picture with the Windows Explorere propertries window or if you open this picture in Adobe PhotoShop Elements.

However jAlbum shows in the Location window (see enclosed screenshot): 53.000000,4.700000
and via meta.get("GPS.GPS Latitude") and meta.get("GPS.GPS Longitude") as used in the PhotoSwipe and SlideShow 4 skin: '53.0,4.7',
jGromit

Posts: 33,207
Registered: 31-Jan-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 20:16   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Attachment ss003230.png (42,3 KB)
I see the wrong values in the Location window - the correct values would be 53.010278, 4.710556. But meta.get retrieves the correct values from the JPG.

I added these lines below the closing <body> tag in Minimal's slide.htt:
<div>
<%=meta.get("Gps.GPS Latitude");%>
<%=meta.get("Gps.GPS Longitude");%>
</div>
And what I get is what you see in the attached screenshot.

My own images don't show the same error in the Location window, but I can't tell what the difference is.
RobM

Posts: 4,387
Registered: 4-Aug-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 21:11   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
I think the problem is that the image has both
xmp.exif:GPSLatitude=53,0,37N
xmp.exif:GPSLongitude=4,42,38E
and
Gps.GPS Latitude=53° 0' 37.49"
Gps.GPS Latitude Ref=N
Gps.GPS Longitude=4° 42' 38.63"
Gps.GPS Longitude Ref=E
If you remove the xmp.exif GPS parameters the image shows the correct information in jAlbum.
jGromit

Posts: 33,207
Registered: 31-Jan-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 22:13   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
I did a little testing of that, but even with both EXIF and xmp GPS coordinates, my images behave properly. The xmp data look a bit different, however.

Mine:
xmp.exif:GPSLatitude=36,13.873443603515625N
xmp.exif:GPSLongitude=116,46.596221923828125W
André's:
xmp.exif:GPSLatitude=53,0,37N
xmp.exif:GPSLongitude=4,42,38E
André's image also trips up the gpsLocation jAlbum variable, which is why it displays incorrectly in the Location box. When you're calling meta.get("GPS Latitude"), for example, that's grabbing only the EXIF value - it doesn't matter what other metadata are in there. In fact, a skin probably shouldn't use that call, because it wouldn't pick up GPS coordinates that were entered via jAlbum - those are written out as xmp only, not EXIF.
RobM

Posts: 4,387
Registered: 4-Aug-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 22:18   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
I did a little testing of that, but even with both EXIF and xmp GPS coordinates, my images behave properly. The xmp data look a bit different, however.

Mine:

xmp.exif:GPSLatitude=36,13.873443603515625N
xmp.exif:GPSLongitude=116,46.596221923828125W
André's:
xmp.exif:GPSLatitude=53,0,37N
xmp.exif:GPSLongitude=4,42,38E
André's image also trips up the gpsLocation jAlbum variable, which is why it displays incorrectly in the Location box. When you're calling meta.get("GPS Latitude"), for example, that's grabbing only the EXIF value - it doesn't matter what other metadata are in there. In fact, a skin probably shouldn't use that call, because it wouldn't pick up GPS coordinates that were entered via jAlbum - those are written out as xmp only, not EXIF.
I also tried looking at the location in another application and it too came up with the wrong location. It seems to point to the image being the problem, not jAlbum.
jGromit

Posts: 33,207
Registered: 31-Jan-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 22:23   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Depends on the application. Both photo viewers in Win10 handle it correctly, as does Picasa. Maybe they're looking only at the EXIF coordinates, which are correct.

At least it's easy to tell with this example - the correct coordinates put the photographer on the beach, while the incorrect ones put him somewhere offshore. Or is it the other way around? ;)
karlmistelberger

Posts: 737
Registered: 5-Dec-2013
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 22:23   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
Enclosed picture contains the next GPS coordinates:

53.010414°, 4.710730° or 53°0'37" N 4°42'38" E

You see this info if you opens the picture with the Windows Explorere propertries window or if you open this picture in Adobe PhotoShop Elements.

However jAlbum shows in the Location window (see enclosed screenshot): 53.000000,4.700000
and via meta.get("GPS.GPS Latitude") and meta.get("GPS.GPS Longitude") as used in the PhotoSwipe and SlideShow 4 skin: '53.0,4.7',


Move the erroneous data to trash and you are on safe terrain:

http://karlmistelberger.jalbum.net/testjAlbum/#img=2011%2009%2029_0326.jpg

Open the image in edit mode and click location in the right hand side panel.

Edited by: karlmistelberger on 10-Sep-2017 16:02
RobM

Posts: 4,387
Registered: 4-Aug-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 22:50   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
Depends on the application. Both photo viewers in Win10 handle it correctly, as does Picasa. Maybe they're looking only at the EXIF coordinates, which are correct.

At least it's easy to tell with this example - the correct coordinates put the photographer on the beach, while the incorrect ones put him somewhere offshore. Or is it the other way around? ;)

I used On1 RAW to display the file info. It has a GPS button, clicking that takes you to
https://www.google.com/maps/place/53°00'00.0%22N+4°42'00.0%22E/@53,4.6978113,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d53!4d4.7?hl=en
Apple's Photos app shows the location as just on the coast of Nationaal Park Duinen van Texel, Den Hoorn, Netherlands
jGromit

Posts: 33,207
Registered: 31-Jan-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 23:00   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
That Google maps link is unfixable in the forum software but, yes, it's a watery location indeed.
jGromit

Posts: 33,207
Registered: 31-Jan-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 09-Sep-2017 23:01   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
AndreWolff

Posts: 2,154
Registered: 14-Dec-2007
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 10-Sep-2017 09:53   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
I added these lines below the closing <body> tag in Minimal's slide.htt:
<div>
<%=meta.get("Gps.GPS Latitude");%>
<%=meta.get("Gps.GPS Longitude");%>
</div>
And what I get is what you see in the attached screenshot.
I did not give the correct information.

I fetch in my skin the GPS information with function getLocation():

String formatGps(String coord) {
	if (isEmpty(coord)) return null;
	int i;
	String[] s = coord.split("[°\'\" ]", 4);
	double degrees = 0L, minutes = 0L;
	float seconds = 0.0f;
	try {
		degrees = Double.parseDouble(s[0]);
		if(s.length > 1) 
			minutes = Double.parseDouble(s[1]);
		if(s.length > 2)
			seconds = Float.parseFloat(s[2]);
	}
	catch (NumberFormatException e) {
		log("Number error", e);
		return null;
	}
	java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
	df.setDecimalSeparatorAlwaysShown(false);
	df.setMaximumFractionDigits(5);
	return (df.format(degrees + (minutes * 60 + seconds) / 3600)).replace(',', '.');
}
 
// Retrieving GPS coodinates from gpsLatitude and gpsLongitude jAlbum variables
 
String getLocation() {
	String lon, lat, lonr, latr;
	
	if ( gpsLocation != void && gpsLocation.matches("([-\\d.]+),\\s*([-\\d.]+)")) {
		System.out.println("gpsLocation: " + gpsLocation);
		return gpsLocation;
	}
	else if (meta != void && !isEmpty(meta) &&
		!isEmpty(lat = meta.get("Gps.GPS Latitude")) &&
		!isEmpty(lon = meta.get("Gps.GPS Longitude")) &&
		(lat = formatGps(lat)) != null &&
		(lon = formatGps(lon)) != null )
		 {
			if ((latr = meta.get("Gps.GPS Latitude Ref")) != null && latr.equals("S")) lat = "-" + lat;
			if ((lonr = meta.get("Gps.GPS Longitude Ref")) != null && lonr.equals("W")) lon = "-" + lon;
			return (lat + "," + lon).replaceAll("--", "");
		 }
	return null;


I added a debug statement and it turns out that gpsLocation is used.
gpsLocation: returns 53.0,4.7 which is incorrect. I think the Location window uses also gpsLocation, because it shows the same wrong value.

This code is far too complicated for me, I did copy this of course from another skin.

If I remove the if ( gpsLocation part and use only the if (meta != void && !isEmpty(meta) && code,
the correct value is fetched:
meta Latitude: 53° 1' 29,48"
meta Longitude: 4° 43' 3,48"
but I get a crash because apparently the split function in function formatGps is not correctly working:

coord: 53° 1' 29,48"
s[0]: 53
s[1]:
s[2]: 1

Edited by: AndreWolff on 10-Sep-2017 10:24

BTW if I make my test album with the Minimal skin, I get the same wrong location, see here

Edited by: AndreWolff on 10-Sep-2017 11:28:

I found how to use the meta data:

String formatGps(String coord) {
	if (isEmpty(coord)) return null;
	coord = coord.replaceAll(",", ".").replaceAll(" ", "");
	String[] s = coord.split("[°\'\" ]");
	double degrees = 0L, minutes = 0L;
	float seconds = 0.0f;		
	try {
		degrees = Double.parseDouble(s[0]);
		if(s.length > 1) 
			minutes = Double.parseDouble(s[1]);
		if(s.length > 2)
			seconds = Float.parseFloat(s[2]);
	}
	catch (NumberFormatException e) {
		log("Number error", e);
		return null;
	}
	java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
	df.setDecimalSeparatorAlwaysShown(false);
	df.setMaximumFractionDigits(5);
	return (df.format(degrees + (minutes * 60 + seconds) / 3600)).replace(',', '.');
}
 
String getLocation() {
	String lon, lat, lonr, latr;
if (meta != void && !isEmpty(meta) &&
		!isEmpty(lat = meta.get("Gps.GPS Latitude")) &&
		!isEmpty(lon = meta.get("Gps.GPS Longitude")) &&
		(lat = formatGps(lat)) != null &&
		(lon = formatGps(lon)) != null )
		 {
			if ((latr = meta.get("Gps.GPS Latitude Ref")) != null && latr.equals("S")) lat = "-" + lat;
			if ((lonr = meta.get("Gps.GPS Longitude Ref")) != null && lonr.equals("W")) lon = "-" + lon;
			return (lat + "," + lon).replaceAll("--", "");
		 }
	return null;
}


To see the result see here.

So meta.get works correctly but the prefered gpsLocation gives an incorrect value.
AndreWolff

Posts: 2,154
Registered: 14-Dec-2007
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 10-Sep-2017 11:18   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
If you remove the xmp.exif GPS parameters the image shows the correct information in jAlbum.
Where can I find xmp.exif and how can I remove it?
RobM

Posts: 4,387
Registered: 4-Aug-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 10-Sep-2017 11:57   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
RobM wrote:
If you remove the xmp.exif GPS parameters the image shows the correct information in jAlbum.
Where can I find xmp.exif and how can I remove it?
See the image you posted at the start of this thread, https://jalbum.net/forum/servlet/JiveServlet/download/2-53092-320343-17262/jAlbumGpsBug.PNG
Just click the trash can icon
AndreWolff

Posts: 2,154
Registered: 14-Dec-2007
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 10-Sep-2017 12:51   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
See the image you posted at the start of this thread, https://jalbum.net/forum/servlet/JiveServlet/download/2-53092-320343-17262/jAlbumGpsBug.PNG
Just click the trash can icon
I think this is a wrong link: it just downloads my own screenshot and I see no trash can icon
RobM

Posts: 4,387
Registered: 4-Aug-2006
Re: Jalbum 14.1.10 for Windows 10 extracts the wrong GPS value from a picture.
Posted: 10-Sep-2017 13:54   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
RobM wrote:
See the image you posted at the start of this thread, https://jalbum.net/forum/servlet/JiveServlet/download/2-53092-320343-17262/jAlbumGpsBug.PNG
Just click the trash can icon
I think this is a wrong link: it just downloads my own screenshot and I see no trash can icon
See the image you posted at the start of this thread, just click the trash can icon. The link was to that image, look at it - there is a trash can icon at the lower right.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums