Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/content/60/9972860/html/smf/Sources/Load.php(225) : runtime-created function on line 3
iView script for GPS data
The DAM Forum
Welcome, Guest. Please login or register.
January 20, 2021, 09:45:40 PM

Login with username, password and session length
Search:     Advanced search
28033 Posts in 5147 Topics by 2903 Members
Latest Member: kbroch
* Home Help Search Login Register
+  The DAM Forum
|-+  General
| |-+  GPS/ Geotagging
| | |-+  iView script for GPS data
« previous next »
Pages: [1] 2 Print
Author Topic: iView script for GPS data  (Read 37477 times)
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« on: March 07, 2007, 08:31:42 AM »

I don't geotag, so this iView Windows script (inspired by a feature in Lightroom) was only a curiosity which successfully diverted me from what I should have been doing a week or two ago....

If the image has GPS data in iView, the script launches Firefox and jumps to those co-ordinates in Google Earth. Hopefully someone can recode it for the Mac too - I'd be interesting in seeing how that looks.

The script is very rough. So no error checking, and it assumes Firefox is installed - one rainy day I'll make it look for the Windows' default, but it's easy enough to insert Opera or IE.

It's completely unsupported - so please do not email to ask why it's not working - but I hope others find it interesting too.

John

Code:
'identify browser
exeFile = """C:\Program Files\Mozilla Firefox\firefox.exe"""
'once off - for testing
urlPrefix = " " & """http://maps.google.com/?ie=UTF8&q="
urlSuffix = "&spn=0.020565,0.054245&h&om=1&z=12&t=h"""

Set IViewApp = CreateObject("iView.Application") 
If (IViewApp.Catalogs.Count = 0) Then
        MsgBox "Please launch Iview MediaPro.", vbCritical, kMsgBoxTitle
End If

Set ivCat = IViewApp.ActiveCatalog
Set ivItem = ivCat.Selection(1)

myLat= left(ivItem.DeviceInfo.Latitude, len(ivItem.DeviceInfo.Latitude)-1) & ", " &ivItem.DeviceInfo.Longitude

set Wshshell= createobject("wscript.shell")
retcode = Wshshell.run (exeFile & urlPrefix & myLat & urlSuffix , 1, TRUE)
Logged
drmrbrewer
Newbie
*
Posts: 26


View Profile
« Reply #1 on: March 08, 2007, 12:27:26 AM »

Thanks for that, John.

I found the following adaptation worked for IE.  Not only is exeFile changed, but I also found I needed to change from utf8 to iso-8859-1, because otherwise the degree symbol wasn't getting through to google maps as it should.  I also found I didn't need the "spn=" bit, and I changed the default zoom level and type.

I don't generally geotag, but have recently been trying out a neat little prototype built by my brother-in-law:

http://www.customidea.com/images/GPS1Sm.jpg

Thanks,

Mike


Code:
'identify browser
exeFile = """C:\Program Files\Internet Explorer\iexplore.exe"""
'once off - for testing
urlPrefix = " " & """http://maps.google.com/?ie=ISO-8859-1&q="
urlSuffix = "&z=15&t=m"""

Set IViewApp = CreateObject("iView.Application")  
If (IViewApp.Catalogs.Count = 0) Then
        MsgBox "Please launch Iview MediaPro.", vbCritical, kMsgBoxTitle
End If

Set ivCat = IViewApp.ActiveCatalog
Set ivItem = ivCat.Selection(1)

myLat= left(ivItem.DeviceInfo.Latitude, len(ivItem.DeviceInfo.Latitude)-1) & ", " &ivItem.DeviceInfo.Longitude

set Wshshell= createobject("wscript.shell")
retcode = Wshshell.run (exeFile & urlPrefix & myLat & urlSuffix , 1, TRUE)
Logged
Dierk
Full Member
***
Posts: 212


149167100 Dierk54@Hotmail.com Evo2Me dhslowhand
View Profile WWW Email
« Reply #2 on: March 08, 2007, 08:59:38 AM »

Mike, I adjusted John's script with your changes and it works quite well. Had to make one change though, and there is some trouble with interaction:

1. ISO-8859-1 does not work with my photos, the degree symbol gets preceded by a capital accented A; UTF-8 works.
2. GoogleMaps loads forever although the correct position and map is shown. After a while one gets a message that there are no data at that zoom level. Complete nonsense, if you zoom in or out everything is fine; you can forego the error message by zooming instantly when arriving.
Logged

Dierk

IDimager on Windows XP/SP2; 3.2 GHz, 2 GB RAM, loads of storage space.
Other: Nikon D2x, Nikon D200, Capture NX 2, Adobe Creative Suite 3
drmrbrewer
Newbie
*
Posts: 26


View Profile
« Reply #3 on: March 08, 2007, 09:18:05 AM »

Hi Dierk

Re your 1:  Strange.  For the degree symbol, UTF-8 works for you and ISO-8859-1 doesn't, whereas for me it's the other way around!  What version of IE are you on?  I'm still on IE6.  And I guess you've got the German version of MediaPro?  Maybe that makes a difference?  Still, so long as one or the other works, it's OK.

Re your 2: I sometimes find it displays a message that map data is not available at that zoom level (for some of the rendered map), but a quick refresh (F5) soon kicks it into doing what it was asked.

It is neat to be able to jump to a map direct from MediaPro, and I'm warming to the idea of using a GPS unit for every shot I take (the GPS prototype unit I'm using, as linked to previously, is small and convenient enough to sneak into a tiny, unused corner of my camera bag, and it's all self-contained in a single unit/cable, plugging in and staying in without any fuss).  All I need to know now is where to find a spare screw-in cap for the 10-pin socket for the inevitable time when I lose my existing one!

Cheers,

Mike
Logged
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #4 on: March 08, 2007, 09:30:51 AM »

Funny, those UTF/ISO changes seem browser specific. If I use 8859 with Firefox as the executable file, I get some place near Wichita rather than the Hamburg coordinates in my test image. With IE6 it works correctly.
 
John
Logged
Dierk
Full Member
***
Posts: 212


149167100 Dierk54@Hotmail.com Evo2Me dhslowhand
View Profile WWW Email
« Reply #5 on: March 08, 2007, 10:03:33 AM »

My standard browser is Opera [9.1], I avoid German UIs like the devil holy water [if possible] and MediaPro luckily gives me the choice to work in its original English, which I do.
Logged

Dierk

IDimager on Windows XP/SP2; 3.2 GHz, 2 GB RAM, loads of storage space.
Other: Nikon D2x, Nikon D200, Capture NX 2, Adobe Creative Suite 3
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #6 on: March 09, 2007, 12:13:21 PM »

Any AppleScripters here? This is nearly ready but I've hit a problem sending the latitude and longitude to the browser. Any ideas?

John

Code:
on run
-- get the list of selected ID's in front window
set selectedItems to GetSelection()
set urlPrefix to "http://maps.google.com/?ll="

-- process each item
tell application "iView MediaPro"
repeat with theItem in selectedItems
set theInfo to the device info of theItem
set the theText to latitude of theInfo & ", " & longitude of theInfo
end repeat
end tell

display dialog ¬
urlPrefix & theText buttons {"OK"} default button ¬
"OK" with icon note giving up after 10

tell application "Safari"
activate
do JavaScript "window.open('" & urlPrefix & theText & "')" in document 1

end tell
end run


-- get the selected media items in an array ---------------------------------------------
on GetSelection()
set selectedItems to {}
tell application "iView MediaPro"
if catalog 1 exists then set selectedItems to the selection of catalog 1
end tell
if number of items in selectedItems is 0 then
display dialog ¬
"You need to select at least one media item in the front catalog in order to use this script." buttons {"OK"} default button ¬
"OK" with icon note giving up after 10
error number -128
end if
return selectedItems
end GetSelection
Logged
drmrbrewer
Newbie
*
Posts: 26


View Profile
« Reply #7 on: March 11, 2007, 05:39:25 AM »

I've coded something up that allows you to select a whole bunch of images in MediaPro, and display them as separate markers on a google map.  

Optionally, you can also have thumbnails for each image displayed by clicking on the marker, like this (excuse the compression):



If anyone is interested, I can email the files.  It requires a MediaPro script, and a separate script functions file for use by the html file that is generated by the MediaPro script (and a zoom icon displayed during mouse wheel zooming).

Further options for tweaking are limitless...

Miie
Logged
Dierk
Full Member
***
Posts: 212


149167100 Dierk54@Hotmail.com Evo2Me dhslowhand
View Profile WWW Email
« Reply #8 on: March 11, 2007, 06:33:59 AM »

Yeah, I am interested.

Let me see that I understand this right:

1. Select a bunch of images in MediaPro
2. Make them a Set [probably optional, depending on the script]
3. Run the script on this set [or the selected files]
4. MP creates a Web gallery
5. The Web gallery's info is read out and sent to GoogleMaps
6. GoogleMaps shows all positions of the photos plus thumbnails

Right?
Logged

Dierk

IDimager on Windows XP/SP2; 3.2 GHz, 2 GB RAM, loads of storage space.
Other: Nikon D2x, Nikon D200, Capture NX 2, Adobe Creative Suite 3
peterkrogh
Administrator
Hero Member
*****
Posts: 5682


View Profile Email
« Reply #9 on: March 11, 2007, 07:27:27 AM »

Mike,
I'm interested too.
Peter
Logged
drmrbrewer
Newbie
*
Posts: 26


View Profile
« Reply #10 on: March 11, 2007, 08:40:09 AM »

Hi Dierk, Peter,

I'll try and tidy things up a little and put in some comments to make it more user-friendly to use/adapt, then email the files to you.

Dierk:

Making a set is optional.  It just works on the selected images, whether or not they are part of a set.  And it isn't based on MediaPro's Web Gallery function (although I've separately added this google maps feature to my web gallery template to allow a map to be overlayed on the existing web page -- the map being resizeable and draggable).

This script just creates a local html file that is then opened up (automatically) in a browser (currently IE -- you'd have to tweak to change browser).  So it's intended more as a local bolt-on to MediaPro, although I guess there's no reason why you couldn't use the resulting html file on a server for others to view.

The script cycles through the selected images, writing information into an html file, which is generated on the fly.  The html page itself is quite lean, but relies heavily on calling javascript functions from the separate functions file. 

The thumbnails for the popups are generated automatically by the script simply by calling MediaPro's "Convert Images" function, and so does slow things down somewhat -- but this feature is easily turned on/off with a simple true/false flag in the script.

It's all based on the google maps API, and hacked together rather un-elegantly, most probably, from a purist's point of view.

Mike
Logged
peterkrogh
Administrator
Hero Member
*****
Posts: 5682


View Profile Email
« Reply #11 on: March 11, 2007, 08:52:55 AM »

Mike,
as part of what you send me, will you include the code for the HTML gallery?

This sounds very interesting.
Peter
Logged
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #12 on: March 11, 2007, 09:06:59 AM »

Sounds interesting, Mike, count me in.

John
Logged
Dierk
Full Member
***
Posts: 212


149167100 Dierk54@Hotmail.com Evo2Me dhslowhand
View Profile WWW Email
« Reply #13 on: April 02, 2007, 11:58:38 PM »

Here's one [test drive] result of Mike's script with a handful of nice dishes still running around a week before being served:

GPS'ed

Zooming in and switching to hybrid, then clicking the points gives you the best experience. This is a wonderful new dimension to classical reportage [that is, conveying a sense of place, time and emotion].
Logged

Dierk

IDimager on Windows XP/SP2; 3.2 GHz, 2 GB RAM, loads of storage space.
Other: Nikon D2x, Nikon D200, Capture NX 2, Adobe Creative Suite 3
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #14 on: June 24, 2007, 02:10:30 AM »

Anyone feel like reviving this effort?

John
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!