Locked GPS Scripts

  • Monday, April 21, 2008 7:32 PM
     
      Has Code
    The following is a VBS script (Windows) which will use the GPS data in your images and update the City and Country information.

    The script uses a publc web-service, so be aware that your GPS data is being sent to this site. Only use this script if you are comfortable with that.

    You can download the script here: http://go.microsoft.com/fwlink/?LinkId=116859

    For more information on scripts, checkout this page: http://www.iview-multimedia.com/downloads/scripts.php

    This script is not supported, but if free for you to customize and modify.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Edited by Felix Andrew MS Friday, April 25, 2008 5:28 PM Marked as "Has Code"
    •  

All Replies

  • Friday, July 11, 2008 2:30 PM
     
     
    Nice stuff, Felix. Duly customized to include State and Location - here

    John in Dulwich




    John Beardsworth
    MVP Expression Media
    Author, Photographer, Consultant
    www.beardsworth.co.uk
  • Sunday, September 14, 2008 4:31 PM
     
     
    Felix Andrew MS said:

    The following is a VBS script (Windows) which will use the GPS data in your images and update the City and Country information.

    The script uses a publc web-service, so be aware that your GPS data is being sent to this site. Only use this script if you are comfortable with that.

    You can download the script here: http://go.microsoft.com/fwlink/?LinkId=116859

    For more information on scripts, checkout this page: http://www.iview-multimedia.com/downloads/scripts.php

    This script is not supported, but if free for you to customize and modify.


    This posting is provided "AS IS" with no warranties, and confers no rights.


    thanks for the script , i run under xp
    i get the error
    "necessary object 'citynode'
    scr: run-time error of vbscript microsoft
    line:52 error:0 scode:800a01a8
  • Sunday, September 14, 2008 4:39 PM
     
      Has Code
    John Beardsworth said:

    Nice stuff, Felix. Duly customized to include State and Location - here

    John in Dulwich




    John Beardsworth
    MVP Expression Media
    Author, Photographer, Consultant
    www.beardsworth.co.uk


    thanks
    i tried the script under xp
    but i get expression media freezes and
    give me the error

    the component Activex can't create the object  "iview.aplication
    scr :runtime error microsoft vscipt
    line 13  error 0  scode: 800a01ad
  • Sunday, September 14, 2008 5:45 PM
     
     
    The 'iview.application' error is because John's script contains lines for both iView and Expression Media.  However the Expression Media line is commented out.  You need to change this.

    Original file
        Set app = CreateObject("iView.Application")
        ' Set app = CreateObject("ExpressionMedia.Application")

    For Expression it should be
        ' Set app = CreateObject("iView.Application")
        Set app = CreateObject("ExpressionMedia.Application")

    In fact you can remove the iView line.


    The citynode error is more difficult.  If the script has never worked for you then suggest you check that you have copied the script correctly.  If it has worked for some images but then failed I would guess that the call that is being made to Geonames with your GPS data is returning an error, and that this script can't handle it.  Unless you post the 'exact' GPS data that is in the image that is failing no-one will be able to help you.  You can test this by using the following links, which is all the script is doing - change the lat and lng values to suit.  The first one 'works', and is somewhere in Austria.  The second one 'fails' - it's about 150 miles west of Malta in the Mediterranean i.e. it doesn't have a place name! 

    http://ws.geonames.org/findNearbyPlaceName?lat=47.3&lng=9

    http://ws.geonames.org/findNearbyPlaceName?lat=35&lng=17


    There is another possibility in that, unless you pay them, Geonames only allow for 50,000 hits per day per IP address.  You will get an error status back from them if you exceed this!

    Ian
  • Monday, September 15, 2008 11:14 AM
     
     
    ian.w said:

    The 'iview.application' error is because John's script contains lines for both iView and Expression Media.  However the Expression Media line is commented out.  You need to change this.

    Original file
        Set app = CreateObject("iView.Application")
        ' Set app = CreateObject("ExpressionMedia.Application")

    For Expression it should be
        ' Set app = CreateObject("iView.Application")
        Set app = CreateObject("ExpressionMedia.Application")

    In fact you can remove the iView line.


    The citynode error is more difficult.  If the script has never worked for you then suggest you check that you have copied the script correctly.  If it has worked for some images but then failed I would guess that the call that is being made to Geonames with your GPS data is returning an error, and that this script can't handle it.  Unless you post the 'exact' GPS data that is in the image that is failing no-one will be able to help you.  You can test this by using the following links, which is all the script is doing - change the lat and lng values to suit.  The first one 'works', and is somewhere in Austria.  The second one 'fails' - it's about 150 miles west of Malta in the Mediterranean i.e. it doesn't have a place name! 

    http://ws.geonames.org/findNearbyPlaceName?lat=47.3&lng=9

    http://ws.geonames.org/findNearbyPlaceName?lat=35&lng=17


    There is another possibility in that, unless you pay them, Geonames only allow for 50,000 hits per day per IP address.  You will get an error status back from them if you exceed this!

    Ian



    well
    thanks for you answer
    the script doesn't work
    it gives me errors only for the photos with latitude and longitude
    it did not give me error with pics without latitude and longitude

    for example i upload a screenshot with the cordinates
    i think they are precise, exact

    http://img117.imageshack.us/my.php?image=mare005zm7.jpg
  • Monday, September 15, 2008 7:28 PM
     
     
    Please use Reply and not Quote.  It helps to keep the message thread shorter!

    There's nothing wrong with the co-ordinates in your image.  However if I convert your co-ordintates to decimal (which the script does) using
    http://www.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html and then feed them into this web service using http://ws.geonames.org/findNearbyPlaceName?lat=45.3378&lng=12.3179 which is what the script does) I get the following reply:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

    <
    geonames>
     <
    geoname
    >
      <
    name>Santa Maria del Mare</name
    >
      <
    lat>45.3286111</lat
    >
      <
    lng>12.3202778</lng>

      <
    geonameId>3219349</geonameId>
      <
    countryCode>IT</countryCode
    >
      <
    countryName>Italy</countryName>

      <
    fcl>P</fcl>
      <
    fcode>PPL</fcode
    >
      <
    distance>1.0385</distance>

     </
    geoname>
    </
    geonames
    >

    This location doesn't have a City Code, which is why the script is failing.  There are two solutions.  Either the script is improved to handle errors better i.e. it should populate what data it can and not crash with any gaps.  I don't know enough about VBA to help.  Second, someone could register with Geonames and help them to improve the quality of their data.

    Ian
  • Tuesday, September 16, 2008 5:55 AM
     
     
    Thanks Ian

    the strange thing is that the cordinates are linked to Venezia Venice (italy) , it  's a famous city

    i tried with Roma (Rome) too , but the script does not work too
    • Edited by mantra siva Tuesday, September 16, 2008 5:57 AM
    •  
  • Tuesday, September 16, 2008 6:50 AM
     
     

    There's a lot of information on Geonames and most of it has come from official organisations within many countries.   However the quality will vary.

    If you go to http://www.geonames.org/ and enter Santa Maria del Mare and click on "Show on Map" it will show the Google Earth map for the Venice area, although you may need to zoom in quite a bit!

    There should be a list of places under the map, with just Santa Maria del Mare.  You should see a "P" characters in a grey/white marker.  If you click on this it should display all the data it has for this place.  It says it is in Italy, in the Region (aka State) of Veneto in the Provincia di Venezia.  However it doesn't think it is actually part of Venice.  Maybe it the border for Venice doesn't include this area.  If you click on Edit you will see that there is no Admin3 data, which you expect to be Venice.  You can click this to edit it and it will give you a list of possible values.  Unless you register with Geonames you won't be able to save the data.  If you think it is wrong then do register with them and help correct it.  I think any changes you do will be reviewed for quality but if the community thinks your change is correct then it would get accepted.  Maybe the script would then work for you as the data would be there.

    Ian

  • Wednesday, September 24, 2008 1:03 PM
     
     
    i have location , city and nation

    is there are way to add gps cordinates for all my photos automatically ?

    i mean i have 20 photos with city=paris nation=france ,15 photos with city=rome nation=italy and so on

    is there a way or script to find the cordinates for all my photos with 1 click?
  • Thursday, November 27, 2008 4:49 PM
     
     
    Ran into the same problem and gave it a closer look. The problem is XML related: only "." are accepted as comma-separators by the web-service. If you "produce" a different character by your language settings (in German i.e. a ",") the web service will not return a "useful" XML.

    So I changed the code a bit (and corrected a "SOUTH" problem as well :-). The function Degrees should now be: 

    Function Degrees(value)
        Dim NESW
        Dim Degree, rawDegrees
        Dim Minutes, Seconds

        NESW    = Mid(value,1,1)
        Degree  = Mid(value,3,3) + 0
        Minutes = Mid(value,8,2) / 60
        Seconds = Mid(value,12,4) / 60 / 60

        Dim Sign
        Sign = 1
        If( NESW = "W" or NESW = "S") Then
            Sign = -1
        End If
        rawDegrees = Sign * (Degree + Minutes + Seconds)

        Degrees = Replace (rawDegrees, "," , "." )

    End Function

    Just replace it in your code and enjoy the results ....

     

    -Thomas