Map It link in Web Galleries

  • Thread starter Thread starter srs67
  • Start date Start date
Status
Not open for further replies.
S

srs67

Guest
I am trying to figure out how I can place a 'Map It' link with my photos in a Lightroom Web Gallery.

The photos have GPS coordinates.

I created a custom 'Text Template'. However, since the Adove GPS format contains double quotes, I cannot get a functional google maps link working. It seems that somehow the format of the GPS data has to change to Latitude, Longitude

Does someone know how to get this 'Map It' link to google maps working?

Here is the custom text template (lrtemplate file) I mentioned:

s = {
deflated = {
{
"<ag:formatted>Map It!</ag:formatted>",
name = "test2",
presetType = "Metadata",
},
"AgTokenPresets",
"restoreTokenFromArchivedState",
},
internalName = "test2",
title = "test2",
type = "Metadata_Tokens",
version = ',
}



Thanks for help!
Stephan.
 
Here's how I worked around it for this gallery.

I created a text template that pulls the GPS data and use it as the Title in the Image Info panel.

I created a variable on the detail.html page:

Code:
local gpsData = string.gsub(image.metadata.title, "\"", " ")

This variable takes whatever is in the Title text template and strips the double-quotes.

Then I added the link that you have to google maps and drop that formatted variable at the end of the URL.

Code:
[url=""http://maps.google.com/maps?q=$gpsData""]Map This![/url]

It works.
 
Heh.. that's where I was going next :) Nice one Rob.

Not doable inside a text template though.

I was wondering if it was possible to use Lua inside a .lrtemplate file, or even if value=string.gsub(com.adobe.GPS, "\"", " ") might work.
 
Yeah, I tweaked the detail.html page inside a copy of the basic HTML gallery package. I didn't know if there was a way to pull the GPS data directly (which would be ideal) so I used the Title text template as a simple source. The only downside of my solution is that you have to only use the Title info for the GPS data, which for me was not a problem.

When I have some more time I'll see if I can get it to work with com.adobe.GPS. That would be cool.
 
There are also some nice variables you can pass to Google Maps to set the zoom level of the map and such that I'd like to go back and add when I have time too.
 
Thanks for your reply Rob!

This all makes sense and I am almost there. The part I still am struggling with is how you add the variable to the detail.html page.
Isn't your variable defined in LUA code? How/where do I add that to the html page?

I also tried the other suggestion (to use value=string.gsub(com.adobe.GPS, "\"", " ") inside the lrtemplate file), but that does not seem to work.


Thanks again!

Stephan.
 
In the top of the detail.html page (inside the Lightroom gallery .lrwebengine that you are tweaking as opposed to the final page that is exported), I just added my new variable below the ones that were already there:

Code:
--[[ Define some variables to make locating other resources easier
     firstPage was defined in our manifest.]]

    local image = getImage( index )
    local theRoot = ".."
    local others = "."
    local mySize = "large"
    local gpsData = string.gsub(image.metadata.title, "\"", " ")
 
I'm glad this discussion is coming up again, Rob. I know we talked about it nearly a year ago. I'd meant to do something with the information, but got lost in the shuffle of things. I've recently been meaning to get back in touch with you about it.
 
Rob,

thanks very much for your help!! Everything works now.


It would be nice to have somethings built into a future release of LR for this. For the default html gallery the suggestions above work great. But for other web galleries (turninggate highslide and others for example) the file changes will have to be different.
 
I'm glad this discussion is coming up again, Rob. I know we talked about it nearly a year ago. I'd meant to do something with the information, but got lost in the shuffle of things. I've recently been meaning to get back in touch with you about it.

That would be great Matthew. I know you have a lot going on these days. Shoot me an email or PM through here if I can be of any help. :)
 
Rob,

thanks very much for your help!! Everything works now.


It would be nice to have somethings built into a future release of LR for this. For the default html gallery the suggestions above work great. But for other web galleries (turninggate highslide and others for example) the file changes will have to be different.

Glad to hear it Stephan! I did tweak one of Matthew's galleries in a similar fashion, but it was one of the HTML galleries. I'd certainly be glad for more support for this in other galleries.
 
I've just been playing with this, and noticed that to get the map centred on the photo you need to convert the GPS coordinates to decimal format. Here's some Lua code that does this (as described above, it lives in detail.html):

Code:
--[[ Define some variables to make locating other resources easier
   firstPage was defined in our manifest.]]

  local image = getImage( index )
  local theRoot = ".."
  local others = "."
  local mySize = "large"

  local gpsData = image.metadata.title
  if gpsData ~= "" then
   local iter = string.gmatch(image.metadata.title, "%d+")
   lat = iter() + (iter() * 6' + iter()) / 36''
   lon = iter() + (iter() * 6' + iter()) / 36''
   if string.find(gpsData, "S") then
    lat = -lat
   end
   if string.find(gpsData, "W") then
    lon = -lon
   end
   gpsData = lat..","..lon
  end

Use something like this to link to Google Maps further down in detail.html (where globe.png is a 27x25 icon, adjust the absolute position to suit your icon dimensions):

Code:
        &lt;% if model.nonCSS.dropShadows then %&gt;
       &lt;/div&gt;
     &lt;/div&gt;
    &lt;% end %&gt;

   &lt;/div&gt;
   &lt;/a&gt;
   &lt;% if gpsData ~= "" then %&gt;
   &lt;div style="position:absolute;right:73px;top:6px"&gt;&lt;a href="http://maps.google.com/maps?z=16&t=k&q=$gpsData&ll=$gpsData" target="map"&gt;&lt;img src="$theRoot/resources/misc/globe.png" alt="Google Maps"/&gt;&lt;/a&gt;&lt;/div&gt;
   &lt;% end %&gt;
   &lt;div style="clear:both; height:5px"&gt;&lt;/div&gt;

I hope someone finds this useful
 
So I created a web engine called "Lightroom HTML Gallery GPS" which is essentially a copy of the LR HTML Gallery. I would love to modify the detail.html page of this engine as outlined above, but I'm not sure how to open and modify this page. I'm obviously green when it comes to this sort of thing.

When I click to open the file it tries to open with safari, I've also tried opening it with text editor thinking that I could modify it that way. What is the best way to open and modify the detail.html file?

Thanks for all the above info and the thread.
 
Status
Not open for further replies.
Back
Top