This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 54 - Pages: 4 [ 1 2 3 4 | Next ] - Last Post: 8 May 26, 07:37 Last Post By: MarkusD Threads: [ Previous | Next ]
MarkusD

Posts: 867
Registered: 13-Apr-2006
<ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 10:02
 
  Click to reply to this thread Reply
Hi,

for many years I was using the following code
<ja:if exists="originalDate"><i>${originalDate}</i></ja:if>
<ja:else>
<i>${fileDate}</i>
<ja:if test="${fileCategory}" value="video"> | <i>FPS: ${videoFPS} - Auflösung: ${videoWidth}×${videoHeight} - Dauer: ${videoDuration}</i></ja:if>
</ja:else>
<ja:if exists="gpsLocation"> | <a href="https://maps.google.com/?q=${gpsLocation}" class="mylink" rel="noreferrer nofollow"><abbr title="Google"><i class="fa fa-map-marker"> </i></abbr></a>
</ja:if>
<ja:if exists="gpsLocation"> | <%= (gpsLocation? '<a href="https://www.openstreetmap.org/?mlat=' + gpsLocation.split(',')[0] + '&mlon=' + gpsLocation.split(',')[1] + '&zoom=16#map=' + gpsLocation.split(',')[0] + '/' + gpsLocation.split(',')[1] + '" class="mylink" rel="noreferrer nofollow"><abbr title="OSM"><i class="fa fa-map-marker"> </i></abbr></a>' : '') %>
</ja:if>
<ja:if exists="gpsLocation"> | <%= (gpsLocation? '<a href="https://kart.finn.no/?lng=' + gpsLocation.split(',')[1] + '&lat=' + gpsLocation.split(',')[0] + '" class="mylink" rel="noreferrer nofollow"><abbr title="kart.finn.no"><i class="fa fa-map-marker"> </i></abbr></a>' : '') %>
</ja:if>
<ja:if exists="gpsLocation"> | <a href="https://www.windy.com/?${gpsLocation},16" class="mylink" rel="noreferrer nofollow"><abbr title="windy.com"><i class="fa fa-map-marker"> </i></abbr></a>
</ja:if>
<ja:if exists="meta">
<ja:if test="<%=meta.get("Gps.GPS Altitude") != null && !meta.get("Gps.GPS Altitude").equals("") %>"> | <i>Höhe: ${gpsAltitude}</i></ja:if>
<ja:if test="<%=meta.get("Iptc.Country/Primary Location Name") != null %>"> | <i>Land: <%=meta.get("Iptc.Country/Primary Location Name")%></i></ja:if>
<ja:if test="<%=meta.get("Iptc.City") != null %>"> | <i>Stadt: <%=meta.get("Iptc.City")%></i></ja:if>
<ja:if test="<%=meta.get("Iptc.Province/State") != null %>"> | <i>Bundesland: <%=meta.get("Iptc.Province/State")%></i></ja:if>
<ja:if test="<%=meta.get("Iptc.Sub-location") != null %>"> | <i>Ortsdetail: <%=meta.get("Iptc.Sub-location")%></i></ja:if>
</ja:if>
<ja:switch test="${rating}">
<ja:case value="1"> | <span style="color:gold;">&starf;</span></ja:case>
<ja:case value="2"> | <span style="color:gold;">&starf;&starf;</span></ja:case>
<ja:case value="3"> | <span style="color:gold;">&starf;&starf;&starf;</span></ja:case>
<ja:case value="4"> | <span style="color:gold;">&starf;&starf;&starf;&starf;</span></ja:case>
<ja:case value="5"> | <span style="color:gold;">&starf;&starf;&starf;&starf;&starf;</span></ja:case>
<ja:default></ja:default>
</ja:switch>
<ja:if exists="fileTitle"> | ${fileTitle}</ja:if> | ${comment}


Most of the code still works fine. But the extraction of the gpsLocation fails. I don't get any links for Google, OpenStreetMap, Finn and Windy. I'm not sure if this is a Tiger issue, a core issue or my own fault.

Any ideas? Thanks in advance.
Laza

Posts: 1,511
Registered: 6-Sep-2005
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 10:35   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
If a picture has GPS coordinates (see Edit mode -> Location), then the ${gpsLocation} variable exists. Can you check if your pictures contain this data?
JeffTucker

Posts: 8,335
Registered: 31-Jan-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 10:56   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Just as a quick sanity check, I tried one of my own skins, which uses similar logic, though in Groovy rather than in jAlbum scripting language, and it's working fine. Simplified code:
if(exists.gpsLocation) {
	gmLL = gpsLocation.split(",");
	if(gmLL.length == 2 && !(0 == Float.parseFloat(gmLL[0]) && 0 == Float.parseFloat(gmLL[1]))) {
		metaString += getGPSMeta(gpsLocationToDMS(gpsLocation), exifGPSLabel);
	}
}
Maps are working in Tiger, as well.

ETA: Off-topic, but I check for zero coordinates because one user had a camera which, if its GPS was turned off, would plant the image at Null Island instead of leaving the variable empty. ;)
MarkusD

Posts: 867
Registered: 13-Apr-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 11:20   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Laza wrote:
If a picture has GPS coordinates (see Edit mode -> Location), then the ${gpsLocation} variable exists. Can you check if your pictures contain this data?
Yes, it does. See screenshot.
RobM

Posts: 3,982
Registered: 4-Aug-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 12:26   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
MarkusD wrote:
Laza wrote:
If a picture has GPS coordinates (see Edit mode -> Location), then the ${gpsLocation} variable exists. Can you check if your pictures contain this data?
Yes, it does. See screenshot.
You have selected Settings > Advanced > Metadata > XMP as a source? (No gremlins got to your settings)
MarkusD

Posts: 867
Registered: 13-Apr-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 12:30   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
You have selected Settings > Advanced > Metadata > XMP as a source? (No gremlins got to your settings)
Ahem, no, I think. I haven't changed settings for ages. Attached the jap file I used for years.
RobM

Posts: 3,982
Registered: 4-Aug-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 12:38   in response to: MarkusD in response to: MarkusD
Helpful
  Click to reply to this thread Reply
You are doing a lot more testing than needed. Just do one <ja:if exists="gpsLocation">
Then add all of the different map providers you want, without using the redundant <%= (gpsLocation? test
RobM

Posts: 3,982
Registered: 4-Aug-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 12:43   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
MarkusD wrote:
RobM wrote:
You have selected Settings > Advanced > Metadata > XMP as a source? (No gremlins got to your settings)
Ahem, no, I think. I haven't changed settings for ages. Attached the jap file I used for years.
The setting for xmp is false, readXmp=false
MarkusD

Posts: 867
Registered: 13-Apr-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 12:46   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
You are doing a lot more testing than needed. Just do one <ja:if exists="gpsLocation">
Then add all of the different map providers you want, without using the redundant <%= (gpsLocation? test
Rob, OK, this would be to optimise the code, for sure. Most of the code is not my own code, I asked for it many years here in the forum, because I don't know how this code works. Fact is, it worked until a few days ago pretty fine. And I have no idea what changed since. Does that exact code work for you, if I may ask?
RobM

Posts: 3,982
Registered: 4-Aug-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 13:04   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
MarkusD wrote:
RobM wrote:
You are doing a lot more testing than needed. Just do one <ja:if exists="gpsLocation">
Then add all of the different map providers you want, without using the redundant <%= (gpsLocation? test
Rob, OK, this would be to optimise the code, for sure. Most of the code is not my own code, I asked for it many years here in the forum, because I don't know how this code works. Fact is, it worked until a few days ago pretty fine. And I have no idea what changed since. Does that exact code work for you, if I may ask?
I think this should work
<ja:if exists="gpsLocation"> | <a href="https://maps.google.com/?q=${gpsLocation}" class="mylink" rel="noreferrer nofollow"><abbr title="Google"><i class="fa fa-map-marker"> </i></abbr></a>
    | <%= '<a href="https://www.openstreetmap.org/?mlat=' + gpsLocation.split(',')[0] + '&mlon=' + gpsLocation.split(',')[1] + '&zoom=16#map=' + gpsLocation.split(',')[0] + '/' + gpsLocation.split(',')[1] + '" class="mylink" rel="noreferrer nofollow"><abbr title="OSM"><i class="fa fa-map-marker"> </i></abbr></a> | <a href="https://kart.finn.no/?lng=' + gpsLocation.split(',')[1] + '&lat=' + gpsLocation.split(',')[0] + '" class="mylink" rel="noreferrer nofollow"><abbr title="kart.finn.no"><i class="fa fa-map-marker"> </i></abbr></a>’ %> | <a href="https://www.windy.com/?${gpsLocation},16" class="mylink" rel="noreferrer nofollow"><abbr title="windy.com"><i class="fa fa-map-marker"> </i></abbr></a>
</ja:if>
MarkusD

Posts: 867
Registered: 13-Apr-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 13:34   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
OK, I was using JA 39.4.8. I deinstalled that version and installed 39.3.2. And everything is fine again. My old code works perfect.

Compiled album with 39.3.2.
https://www.markus-drueck.de/public/2026%2001%2030%20Norge/2026%2001%2030%20Norge/2026%2002%2002%20%C3%96stersund%20-%20Jokkmokk/index.html#img=IMG_1699.avif

Compiled album with 39.4.8.
https://www.markus-drueck.de/norge/2026%2001%2030%20Norge/2026%2002%2002%20%C3%96stersund%20-%20Jokkmokk/index.html#img=IMG_1699.avif

So I think this is something for team Sweden. :-)

Cheers, Markus

ETA: Maybe it's not JA but Tiger. Tiger 8.0.2. vs. 8.0.3.

Edited by: MarkusD on 2 May 2026, 13:40
JeffTucker

Posts: 8,335
Registered: 31-Jan-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 14:41   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
Important question: Where are you using this code? Is this part of a title or comment, for example?
MarkusD

Posts: 867
Registered: 13-Apr-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 14:45   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Its:
skin.imageCaptionTemplate=<ja\:if exists\="originalDate"><i>${originalDate}</i></ja\:if>\n<ja\:else>\n <i>${fileDate}</i>\n <ja\:if test\="${fileCategory}" value\="video"> | <i>FPS\: ${videoFPS} - Aufl\u00F6sung\: ${videoWidth}\u00D7${videoHeight} - Dauer\: ${videoDuration}</i></ja\:if>\n</ja\:else>\n<ja\:if exists\="gpsLocation">\n | <a href\="https\://maps.google.com/?q\=${gpsLocation}" class\="mylink" rel\="noreferrer nofollow"><abbr title\="Google"><i class\="fa fa-map-marker"> </i></abbr></a>\n</ja\:if>\n<ja\:if exists\="gpsLocation">\n | <%\= (gpsLocation? '<a href\="https\://www.openstreetmap.org/?mlat\=' + gpsLocation.split(',')[0] + '&mlon\=' + gpsLocation.split(',')[1] + '&zoom\=16\#map\=' + gpsLocation.split(',')[0] + '/' + gpsLocation.split(',')[1] + '" class\="mylink" rel\="noreferrer nofollow"><abbr title\="OSM"><i class\="fa fa-map-marker"> </i></abbr></a>' \: '') %>\n</ja\:if>\n<ja\:if exists\="gpsLocation">\n | <%\= (gpsLocation? '<a href\="https\://kart.finn.no/?lng\=' + gpsLocation.split(',')[1] + '&lat\=' + gpsLocation.split(',')[0] + '" class\="mylink" rel\="noreferrer nofollow"><abbr title\="kart.finn.no"><i class\="fa fa-map-marker"> </i></abbr></a>' \: '') %>\n</ja\:if>\n<ja\:if exists\="gpsLocation">\n | <a href\="https\://www.windy.com/?${gpsLocation},16" class\="mylink" rel\="noreferrer nofollow"><abbr title\="windy.com"><i class\="fa fa-map-marker"> </i></abbr></a>\n</ja\:if>\n<ja\:if exists\="meta">\n <ja\:if test\="<%\=meta.get("Gps.GPS Altitude") \!\= null && \!meta.get("Gps.GPS Altitude").equals("") %>"> | <i>H\u00F6he\: ${gpsAltitude}</i></ja\:if>\n <ja\:if test\="<%\=meta.get("Iptc.Country/Primary Location Name") \!\= null %>"> | <i>Land\: <%\=meta.get("Iptc.Country/Primary Location Name")%></i></ja\:if>\n <ja\:if test\="<%\=meta.get("Iptc.City") \!\= null %>"> | <i>Stadt\: <%\=meta.get("Iptc.City")%></i></ja\:if>\n <ja\:if test\="<%\=meta.get("Iptc.Province/State") \!\= null %>"> | <i>Bundesland\: <%\=meta.get("Iptc.Province/State")%></i></ja\:if>\n <ja\:if test\="<%\=meta.get("Iptc.Sub-location") \!\= null %>"> | <i>Ortsdetail\: <%\=meta.get("Iptc.Sub-location")%></i></ja\:if>\n</ja\:if>\n<ja\:switch test\="${rating}">\n <ja\:case value\="1"> | <span style\="color\:gold;">&starf;</span></ja\:case>\n <ja\:case value\="2"> | <span style\="color\:gold;">&starf;&starf;</span></ja\:case>\n <ja\:case value\="3"> | <span style\="color\:gold;">&starf;&starf;&starf;</span></ja\:case>\n <ja\:case value\="4"> | <span style\="color\:gold;">&starf;&starf;&starf;&starf;</span></ja\:case>\n <ja\:case value\="5"> | <span style\="color\:gold;">&starf;&starf;&starf;&starf;&starf;</span></ja\:case>\n <ja\:default></ja\:default>\n</ja\:switch>\n<ja\:if exists\="fileTitle"> | ${fileTitle}</ja\:if>\n | ${comment}
JeffTucker

Posts: 8,335
Registered: 31-Jan-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 15:00   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
OK, time for Debugging 101 again. Create a test project with just one image. In the Tiger settings, go to Lightbox > Caption > Caption template, choose [Custom], and enter just this:
<ja:if exists="gpsLocation"> There is a map </ja:if>
Make the album.

For me, using the latest jAlbum and Tiger releases, I get a caption that reads, "There is a map." Do you?
JeffTucker

Posts: 8,335
Registered: 31-Jan-2006
Re: <ja:if exists="gpsLocation"> not working any more
Posted: 2 May 26, 16:17   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
One longshot: have you installed David's latest metadata package, metadata-extractor-2.20-main.jar? If you do, make sure to remove metadata-extractor-2.15.0.jar. Having both might do strange things.
Legend
Forum admins
Helpful Answer
Correct Answer

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