Re: [Gpsbabel-misc] Local Time (zone) from coords and time (OT)
Brought to you by:
robertl
From: John R. P. <jr...@gm...> - 2010-05-15 07:19:29
|
I may be missing something fundemental here -- but the earth tools things seems to do exactly what you are after. note the terms and conditions (no more than one call, and strict rules about result cashing) use wget or curl to call it by coords, then extract the "offset" value (bash code below will do it for a similar web service, it's extracted from another program, so it won't work without tweaking -- it's a bodge, but for simple cases like this it should work) You will then have to add this value to the time in question, which may be slightly tricky depending on whether there is any tool desgned to do that (i've never played with that) nrby=`curl " http://ws.geonames.org/findNearbyPlaceName?lat=${lin%,*}&lng=${lin#*,}&style=full "` # lin is the input coords in "170.1,30.3" format parsed using substrings for x in $nrby # for each line in response do if [[ "$x" == *countryName* ]]; then # if line contains the string countryName # ${x%*<} # %\<*\> xb=${x#\<*\>} # use substrings to remove the xml tags from around the data xf=${xb%\<*\>} keywords="$keywords$FS$xf" # add the result to a long comma separated list (FB contains a single comma) descr="$descr$FS$xf" fi if [[ "$x" == *adminName* ]] || [[ "$x" == *\<name\>* ]]; then # repeat for another keyword # ${x%*<} # %\<*\> xb=${x#\<*\>} keywords="$keywords$FS${xb%\<*\>}" fi done On 15 May 2010 02:52, Greg <we...@we...> wrote: > These should me closer. I wish they worked in GMT offsets rather than named > time zones, but I'll work on it. > > Greg > > On May 14, 2010, at 4:48 PM, Tom Paton wrote: > > > I think you'll have to combine two sources, first use a webservice (or > > download a database) like > > http://www.geonames.org/export/web-services.html#timezone > > > > This will give you the timezone, you should then be able to use the > > Olson database http://en.wikipedia.org/wiki/Tzdata (via Python's pytz > > module or the equivalent in your favourite language) to get the local > > time in the timezone for the given date. > > > > Tom > > > > On Sat, May 15, 2010 at 9:34 AM, Greg <we...@we...> wrote: > >> I wrote too soon. I don't see what I asked for: Time Zone (or local > time) > >> given lat, long, and a date-time (GMT) in the past from some service or > >> database. An example: Given -118 long, 34 lat and 2010-02-11 14:12:15 > what > >> was the time offset from GMT (or what was the local time then > considering > >> daylight savings). > >> I'll continuing searching if no one has a ready answer > >> > >> On May 14, 2010, at 10:45 AM, Jan Martin wrote: > >> > >> There seem to be a lot of ways to do this: > >> > >> > http://www.google.de/search?q=timezone+from+latitude+longitude&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:official&client=firefox-a > >> > >> Jan > >> > >> On Fri, May 14, 2010 at 7:22 PM, Greg <we...@we...> wrote: > >>> > >>> Is there a source for determining local time or offset from GMT from > the > >>> coords and time? And by that I mean something accessible from a script. > I > >>> want to label the logs for Garmin tracks with the local time (and > eventually > >>> location). I wouldn't expect this to be part of GPSBabel, but this is > hard > >>> to search for, at least for me. > >>> > >>> Thanks > >>> > >>> > ------------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Gpsbabel-misc mailing list http://www.gpsbabel.org > >>> Gps...@li... > >>> To unsubscribe, change list options, or see archives, visit: > >>> https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Gpsbabel-misc mailing list http://www.gpsbabel.org > Gps...@li... > To unsubscribe, change list options, or see archives, visit: > https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc > |