Google Map Lat/Long url in web-gallery template
Has anyone figured out how to generate a google-map html link for the web-gallery media template using the latitude and longitude values called up by (iView:Latitude) and (iView:Longitude) ? If so, I’d love to know how it’s done.
The problem (for me, at least) is that inserting a line in the media template like
<a href="http://maps.google.com/?hl=en&q=loc:(iView:Latitude),(iView:Longitude)"> map </a> doesn't work because the " (the unit symbol for Seconds, as in Degrees, MInutes, and Seconds) on the value for the Latitude's Seconds cuts the latitude-longitude string prematurely short.
I haven't found a way to fix this in html or in java script because the presence of a ' AND a " in the Latitude or Longitude value always cuts the string short when using either a " or a ' as string delimiters, which are the only two possibilities for a string delimiter.
Thanks,
Bob Stokstad
rgs@jstokstad.com
The problem (for me, at least) is that inserting a line in the media template like
<a href="http://maps.google.com/?hl=en&q=loc:(iView:Latitude),(iView:Longitude)"> map </a> doesn't work because the " (the unit symbol for Seconds, as in Degrees, MInutes, and Seconds) on the value for the Latitude's Seconds cuts the latitude-longitude string prematurely short.
I haven't found a way to fix this in html or in java script because the presence of a ' AND a " in the Latitude or Longitude value always cuts the string short when using either a " or a ' as string delimiters, which are the only two possibilities for a string delimiter.
Thanks,
Bob Stokstad
rgs@jstokstad.com
0
-
Here's a solution for making a link to Google Maps for a geo-tagged image in a Media Pro gallery. It's a hack, implemented using the terminal and command line in Mac OS X, but it does the job.
Insert the following line at some appropriate place in the media.html template.
<a href="http://maps.google.com/?hl=en&q=loc:(iView:Latitude),(iView:Longitude)"target="_blank" >Google Map </a>
----
After running Make HTML Gallery, this produces the following line of code in a .html file located in the source folder of the resulting gallery.
<a href="http://maps.google.com/?hl=en&q=loc:N 036° 43' 21.56",W 121° 16' 45.14""target="_blank" >Google Map </a>
(This line will not work in a browser because of the quotes - the symbol for seconds of arc - on the values for Lat and Long.)
------
This can be repaired by running the following unix shell script to remove the offending quotes from all of the .html files in the source folder.
for i in *.html; do sed -e 's/",W/, W/g' -e 's/""/"/g' <$i > $i.temp; done;for file in *.temp ; do mv $file `echo $file | sed 's/.temp//'` ; done
----
This script, operating on the above line of html code, produces
<a href="http://maps.google.com/?hl=en&q=loc:N 036° 43' 21.56, W 121° 16' 45.14"target="_blank" >Google Map </a>
------
Google maps understands this link and produces the desired map.
As an example this solution has been implemented in producing the following gallery.
Note, I was unable to find a solution that could be implemented in the media.html template. Indeed, I believe such a template-based solution does not exist because of the presence of both ' and '' in the i-View values for Lat and Long.
The lesson: If the Lat and Long values in Media Pro were changed to decimal form, this hack would be unnecessary.
Cheers,
Bob Stokstad0 -
Thank you for sharing this alternative.
But it would be so nice to do this without scripting ... (especially since I'm on PC, and that I can adapt this code).
Moreover, the problem is not just the web galleries, but also to export metadata to a text file. DMS to DD conversion, to use GPS data in external software, is always more complex than if it was directly in DD.
I hope the Media Pro team hear this call!
Sylvain M.0
Post is closed for comments.
Comments
2 comments