Re: Timezone lookup?

2009-08-06 Thread Jaldhar H. Vyas

On Thu, 6 Aug 2009, Mark Theodoropoulos wrote:


and yet I don't see any data for the major Indian cities like Mumbai,
 Calcutta or Delhi. If there are Indian cities represented there, I
don't know their names.  And THAT strikes me as odd, given that
India, by itself, has about a quarter of the world's population and
it has some of the world's largest cities.


In 1996 we had to learn to replace 'Bombay' with 'Mumbai'; five years later 
'Calcutta' became--or rather, changed its official English name back to what 
its real name has always been--'Kolkata,' but for some reason Western media 
seem to have ignored that one. There does appear to be a Kolkata in 
DateTime::TimeZone.


Perhaps because Kolkata was never its real name (Kolkata is the Bengali 
pronounciation of Calcutta the name under which the city was founded by 
the British.)  The local government was suffering from Mumbai envy so they 
decided they had to "decolonialize" their name too.  Mumbai on the other 
hand really is Mumbai to its Gujarati and Marathi speaking inhabitants and 
was so before it was anglicized (strictly speaking Portuguesed) to Bombay.


Only the politicians actually care about any of this stuff though. 
Bombay, Mumbai, Sheboygan call it what you like :-)



--
Jaldhar H. Vyas 


Re: Timezone lookup?

2009-08-06 Thread Jim Brunette
Ted Byers wrote:
> On Thu, Aug 6, 2009 at 10:39 PM, J. Shirley wrote:
>   
>> On Thu, Aug 6, 2009 at 7:27 PM, Jim Brunette  wrote:
>>
>> 
>>> Is there a lat/lon database that contains the timezone boundaries?
>>>
>>> With a lat/long TZ DB, users could input their city or zip (or heck, if
>>> they know it, their lat/lon), then the app would associate the user's
>>> lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was
>>> not found, the app would just fall back to the continent/city names).
>>>
>>> To take it one step further, mobile apps with GPS have real-time
>>> lat/lon, so getting the TZ should be easy... How useful such an mobile
>>> app would be is another question.
>>>
>>> Jim
>>>
>>>
>>>
>>>
>>>
>>>
>>>   
>> geonames.org provides this, via a simple HTTP interface.
>>
>> Here's a blog post describing usage:
>> http://vancouverwebconsultants.com/getting-time-zone-from-latitude-longitude/(though
>> in PHP)
>>
>> To fetch, it's very simple:
>> http://ws.geonames.org/timezone?lat=$lat&lng=$lng
>>
>> -J
>>
>> 
> Well live and learn.  Use someone else's hardware and software to do
> the heavy lifting.  ...  ;-)
>
> I'll have to check it out.  It is trivial to write Perl that is
> equivalent to a given PHP code snippet.  ;-)
>
> Thanks
>
> Ted
>
>   

Talk about embarrassing, I already use geonames.org's find* web services
for geocoding--did not look farther down their web services list. Thanks
a bunch, Jay.

Jim


Re: Timezone lookup?

2009-08-06 Thread Ted Byers
On Thu, Aug 6, 2009 at 10:39 PM, J. Shirley wrote:
> On Thu, Aug 6, 2009 at 7:27 PM, Jim Brunette  wrote:
>
>> Is there a lat/lon database that contains the timezone boundaries?
>>
>> With a lat/long TZ DB, users could input their city or zip (or heck, if
>> they know it, their lat/lon), then the app would associate the user's
>> lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was
>> not found, the app would just fall back to the continent/city names).
>>
>> To take it one step further, mobile apps with GPS have real-time
>> lat/lon, so getting the TZ should be easy... How useful such an mobile
>> app would be is another question.
>>
>> Jim
>>
>>
>>
>>
>>
>>
>
> geonames.org provides this, via a simple HTTP interface.
>
> Here's a blog post describing usage:
> http://vancouverwebconsultants.com/getting-time-zone-from-latitude-longitude/(though
> in PHP)
>
> To fetch, it's very simple:
> http://ws.geonames.org/timezone?lat=$lat&lng=$lng
>
> -J
>
Well live and learn.  Use someone else's hardware and software to do
the heavy lifting.  ...  ;-)

I'll have to check it out.  It is trivial to write Perl that is
equivalent to a given PHP code snippet.  ;-)

Thanks

Ted


Re: Timezone lookup?

2009-08-06 Thread Ted Byers
On Thu, Aug 6, 2009 at 10:27 PM, Jim Brunette wrote:
> Is there a lat/lon database that contains the timezone boundaries?
>
> With a lat/long TZ DB, users could input their city or zip (or heck, if
> they know it, their lat/lon), then the app would associate the user's
> lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was
> not found, the app would just fall back to the continent/city names).
>
> To take it one step further, mobile apps with GPS have real-time
> lat/lon, so getting the TZ should be easy... How useful such an mobile
> app would be is another question.
>
> Jim
>
Hey Jim,

I have seen a suite of mobile apps using GPS data.  In fact, one of
the earliest commercial apps I developed involved using GPS to produce
mapping info for farms (do a search on precision agriculture to get a
sense of the kind of app that was - but it is certain it is no longer
on the market as it was designed to crawl on DOS  ;-)

Find a task where time of day is as important as location, and you
have the potential for such a mobile app.

Theoretically, you're right, as long as there is a lat/lon DB
containing TZ boundaries.  But in practical terms, it is another
question.  Determining whether or not a given point is within the
bounds of a given polygon in 2D is not trivial.  It can be done, and
there are well established algorithms to support it, but it carries a
cost; and you can multiply that cost by the average number of polygons
you have to check before you get the right one.  Is there enough
hardware supporting the app for the peak number of users?  And the
list of complications and constraints goes on.

Cheers,

Ted


Re: Timezone lookup?

2009-08-06 Thread J. Shirley
On Thu, Aug 6, 2009 at 7:27 PM, Jim Brunette  wrote:

> Is there a lat/lon database that contains the timezone boundaries?
>
> With a lat/long TZ DB, users could input their city or zip (or heck, if
> they know it, their lat/lon), then the app would associate the user's
> lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was
> not found, the app would just fall back to the continent/city names).
>
> To take it one step further, mobile apps with GPS have real-time
> lat/lon, so getting the TZ should be easy... How useful such an mobile
> app would be is another question.
>
> Jim
>
>
>
>
>
>

geonames.org provides this, via a simple HTTP interface.

Here's a blog post describing usage:
http://vancouverwebconsultants.com/getting-time-zone-from-latitude-longitude/(though
in PHP)

To fetch, it's very simple:
http://ws.geonames.org/timezone?lat=$lat&lng=$lng

-J


Re: Timezone lookup?

2009-08-06 Thread Jim Brunette
Is there a lat/lon database that contains the timezone boundaries?

With a lat/long TZ DB, users could input their city or zip (or heck, if
they know it, their lat/lon), then the app would associate the user's
lat/lon with the TZ lat/lon and output the TZ (if the user's lat/lon was
not found, the app would just fall back to the continent/city names).

To take it one step further, mobile apps with GPS have real-time
lat/lon, so getting the TZ should be easy... How useful such an mobile
app would be is another question.

Jim







Re: Timezone lookup?

2009-08-06 Thread Yitzchak Scott-Thoennes
On Thu, August 6, 2009 7:42 am, Ted Byers wrote:
> Isn't it odd that, in the Asia data, there are values for Gaza and
> Jerusalem, which are only a short distance apart (in terms of how far
> a crow would have to fly to travel between them, not politically), or more
> odd, Kuala Lumpur and Singapore (which are separated only by a narrow
> channel), and yet I don't see any data for the major Indian cities like
> Mumbai, Calcutta or Delhi.  If there are Indian cities
> represented there, I don't know their names.  And THAT strikes me as odd,
> given that India, by itself, has about a quarter of the world's population
> and it has some of the world's largest cities.  And yet, in the american
> data, there are values for Glace Bay, Goose Bay, Thunder Bay, Whitehorse.
> It seems strange that what are tiny little villages
> are represented while such huge cities are not.

While the zones eschew using country as part of the name (because countries
change names much more often than cities do), what is logically one zone,
with consistent offset and dst rules, is represented in the database by
multiple zones, one per country (because the legal changes to offset/dst
rules often happen by country, and otherwise what is one zone now would be
two zones tomorrow much more often).

Within each zone, the most "recognizable" city is used as the name.
In some cases, this isn't the largest.  See the comments in the region
files for rationales, for instance:

# IATA SSIM (1993-02/1994-09) say that the Holiday Islands (Hayman, Lindeman,
# Hamilton) observed DST for two years after the rest of Queensland stopped.
# Hamilton is the largest, but there is also a Hamilton in Victoria,
# so use Lindeman.




Re: Timezone lookup?

2009-08-06 Thread Mark Theodoropoulos

Ted Byers quoth
>>> Isn't it odd that, in the Asia data,

[ . . . ]

>>> and yet I don't see any data for the major Indian cities like Mumbai,
>>>  Calcutta or Delhi. If there are Indian cities represented there, I
>>> don't know their names.  And THAT strikes me as odd, given that
>>> India, by itself, has about a quarter of the world's population and
>>> it has some of the world's largest cities.

In 1996 we had to learn to replace 'Bombay' with 'Mumbai'; five years later 
'Calcutta' became--or rather, changed its official English name back to what 
its real name has always been--'Kolkata,' but for some reason Western media 
seem to have ignored that one. There does appear to be a Kolkata in 
DateTime::TimeZone.


Whatever you decide to call the cities, India's easy: the *whole* country is 
on IST, with no "D*yl*ght S*v*ng"(*) time. So India is GMT+5.5, everywhere, 
all the time. (Except, of course, for some of the huge call-center 
communities that set the clocks to, and live by, one of the North American 
time zones.)


Best regards,
M. Theo









(*) from Mtheopedia:

"DAYLIGHT SAVING" TIME, abbr. DST; also (illit.) "DAYLIGHT SAVINGS," (n.): A 
monstrous contrivance, entailing the annual loss of billions of dollars of 
productivity and several human lives, along with untold misery among the 
survivors, intended to solve a non-existent problem and contributing its 
patch of tar to the road such good intentions inevitably pave, imposed by 
legislative scoundrels and maintained by pressure from the so-called 
"leisure industry," the whole fraud meekly submitted to by a public capable 
of lending credulity to such transparent nonsense as the phrase "'gaining' 
an hour." See also under HOAX, SWINDLE, TORTURE TECHNIQUES, TH'EXPENSE OF 
SPIRIT IN A WASTE OF SHAME, and WINDOWS.


[I wish I could say the 'human lives' part is merely a tasteless joke. Alas, 
it isn't.  --Ed.]



--
m. theo
producer / classics without walls
the anti-warhorse zone / www.amural.com
kusf 90.3fm / san francisco


Re: Timezone lookup?

2009-08-06 Thread Ted Byers
On Thu, Aug 6, 2009 at 1:10 PM, Karl Young wrote:
> Ted Byers(r.ted.by...@gmail.com)@2009.08.06 10:42:45 -0400:
>> On Wed, Aug 5, 2009 at 10:15 PM, Yitzchak
>> Scott-Thoennes wrote:
>> > On Wed, August 5, 2009 12:52 pm, Ted Byers wrote:
>> >> Is there, in the various timezone packages, support somewhere for
>> >> finding out what the timezone is for a given city/state?  I have, in my
>> >> database, extensive data with the usual contact information from users
>> >> from around the world.  If at all possible, I would like to query the data
>> >> managed by one of the timezone packages to determine the local users'
>> >> timezones from their mailing address.  Is this possible?  Using what?
>> >
>> > For countries with a single timezone, you can look it up by iso3166 two
>> > character code in %DateTime::TimeZone::Catalog::ZONES_BY_COUNTRY.
>> >
>> > For other countries, I don't know of such support.  You can read the
>> > comments in zone.tab or the longer comments in the region files in
>> > the tzdata package at ftp://elsie.nci.nih.gov/pub/.
>> >
>> Thanks Yitzchak
>>
>> So the short answer is that there is no solution at present.
>>
>> Although we get traffic from all over the world, the bulk of it is
>> from the US and Canada, each of which has several time zones.  When I
>> look at the documentation for the timezone catalog, I see for north
>> american data for a small number of cities.  Unfortunately that
>> doesn't help for the vast majority of mailing addresses in north
>> america.
>>
>> I naively hoped that someone would have assembled a database mapping
>> state/province codes within countries to their timezones.
>>
>
Thanks Karl,

> Should be easy enough to do: 50 states in US, and all but a few have a
> single timezone.  Canada has fewer provinces, but I suspect most of
> them span timezones.
>
Actually, IIRC there are about 5 time zones in Canada, and there are
ten provinces and three territories.  Alas, I am a rather poor,
ignorant Canadian as I can't recall which provinces use which time
zones.  :-(  Or maybe I am just getting senile.  :-(

> These folks:
>
> http://www.zip-codes.com/zip-code-database.asp
>
> wil sell you a US zipcode database with timezones for $US40.
>
I just learned one of my colleagues found one suitable for the US.

>> Isn't it odd that, in the Asia data, there are values for Gaza and
>> Jerusalem, which are only a short distance apart (in terms of how far
>> a crow would have to fly to travel between them, not politically), or
>> more odd, Kuala Lumpur and Singapore (which are separated only by a
>> narrow channel), and yet I don't see any data for the major Indian
>> cities like Mumbai, Calcutta or Delhi.  If there are Indian cities
>> represented there, I don't know their names.  And THAT strikes me as
>> odd, given that India, by itself, has about a quarter of the world's
>> population and it has some of the world's largest cities.  And yet, in
>> the american data, there are values for Glace Bay, Goose Bay, Thunder
>> Bay, Whitehorse.  It seems strange that what are tiny little villages
>> are represented while such huge cities are not.
>>
>
> I don't know about the Asian data, but the *Bay and Whitehorse entries
> are in Canada, and are likely the biggest population centers in their
> respective timezones.  Canada is really big, eh?  {-;
>
Canada is now the largest country on the planet (second largest prior
to the fracturing of the USSR) in terms of land mass, but it has a
population smaller than many of the larger cities in the developing
world. And most of Canada's population are within easy commute
distance of Toronto, Montreal and Vancouver.  It would be a fun
exercise to figure out how many of the other provinces would have to
be added together to make a population that is of the same order of
magnitude as some of the medium sized cities in southern Ontario.  ;-)

The main geographic reason the US is so large is that there are so
many states in it; most of which could be lost in one or more of the
great lakes adjacent to Ontario.

 And you're probably right about *bay and Whitehorse being the largest
population centres in their regions.  But Thunder Bay is in Ontario,
and is quite small relative to the main cities in southern Ontario
(e.g. Toronto)  And so, since timezones are not likely defined by
latitude, it is certain there are many other cities in their timezones
that are much larger (even thought those other cities are hundreds if
not thousands of miles away).

Cheers,

Ted

>
>
>> Oh well, that's just another thing in this world that doesn't make sense.
>>
>> Thanks anyway,
>>
>> Ted
>


Re: Timezone lookup?

2009-08-06 Thread Karl Young
Ted Byers(r.ted.by...@gmail.com)@2009.08.06 10:42:45 -0400:
> On Wed, Aug 5, 2009 at 10:15 PM, Yitzchak
> Scott-Thoennes wrote:
> > On Wed, August 5, 2009 12:52 pm, Ted Byers wrote:
> >> Is there, in the various timezone packages, support somewhere for
> >> finding out what the timezone is for a given city/state?  I have, in my
> >> database, extensive data with the usual contact information from users
> >> from around the world.  If at all possible, I would like to query the data
> >> managed by one of the timezone packages to determine the local users'
> >> timezones from their mailing address.  Is this possible?  Using what?
> >
> > For countries with a single timezone, you can look it up by iso3166 two
> > character code in %DateTime::TimeZone::Catalog::ZONES_BY_COUNTRY.
> >
> > For other countries, I don't know of such support.  You can read the
> > comments in zone.tab or the longer comments in the region files in
> > the tzdata package at ftp://elsie.nci.nih.gov/pub/.
> >
> Thanks Yitzchak
> 
> So the short answer is that there is no solution at present.
> 
> Although we get traffic from all over the world, the bulk of it is
> from the US and Canada, each of which has several time zones.  When I
> look at the documentation for the timezone catalog, I see for north
> american data for a small number of cities.  Unfortunately that
> doesn't help for the vast majority of mailing addresses in north
> america.
> 
> I naively hoped that someone would have assembled a database mapping
> state/province codes within countries to their timezones.
>

Should be easy enough to do: 50 states in US, and all but a few have a
single timezone.  Canada has fewer provinces, but I suspect most of
them span timezones.

These folks:

http://www.zip-codes.com/zip-code-database.asp

wil sell you a US zipcode database with timezones for $US40.
 
> Isn't it odd that, in the Asia data, there are values for Gaza and
> Jerusalem, which are only a short distance apart (in terms of how far
> a crow would have to fly to travel between them, not politically), or
> more odd, Kuala Lumpur and Singapore (which are separated only by a
> narrow channel), and yet I don't see any data for the major Indian
> cities like Mumbai, Calcutta or Delhi.  If there are Indian cities
> represented there, I don't know their names.  And THAT strikes me as
> odd, given that India, by itself, has about a quarter of the world's
> population and it has some of the world's largest cities.  And yet, in
> the american data, there are values for Glace Bay, Goose Bay, Thunder
> Bay, Whitehorse.  It seems strange that what are tiny little villages
> are represented while such huge cities are not.
> 

I don't know about the Asian data, but the *Bay and Whitehorse entries
are in Canada, and are likely the biggest population centers in their
respective timezones.  Canada is really big, eh?  {-;



> Oh well, that's just another thing in this world that doesn't make sense.
> 
> Thanks anyway,
> 
> Ted


Re: Timezone lookup?

2009-08-06 Thread Ted Byers
On Wed, Aug 5, 2009 at 10:15 PM, Yitzchak
Scott-Thoennes wrote:
> On Wed, August 5, 2009 12:52 pm, Ted Byers wrote:
>> Is there, in the various timezone packages, support somewhere for
>> finding out what the timezone is for a given city/state?  I have, in my
>> database, extensive data with the usual contact information from users
>> from around the world.  If at all possible, I would like to query the data
>> managed by one of the timezone packages to determine the local users'
>> timezones from their mailing address.  Is this possible?  Using what?
>
> For countries with a single timezone, you can look it up by iso3166 two
> character code in %DateTime::TimeZone::Catalog::ZONES_BY_COUNTRY.
>
> For other countries, I don't know of such support.  You can read the
> comments in zone.tab or the longer comments in the region files in
> the tzdata package at ftp://elsie.nci.nih.gov/pub/.
>
Thanks Yitzchak

So the short answer is that there is no solution at present.

Although we get traffic from all over the world, the bulk of it is
from the US and Canada, each of which has several time zones.  When I
look at the documentation for the timezone catalog, I see for north
american data for a small number of cities.  Unfortunately that
doesn't help for the vast majority of mailing addresses in north
america.

I naively hoped that someone would have assembled a database mapping
state/province codes within countries to their timezones.

Isn't it odd that, in the Asia data, there are values for Gaza and
Jerusalem, which are only a short distance apart (in terms of how far
a crow would have to fly to travel between them, not politically), or
more odd, Kuala Lumpur and Singapore (which are separated only by a
narrow channel), and yet I don't see any data for the major Indian
cities like Mumbai, Calcutta or Delhi.  If there are Indian cities
represented there, I don't know their names.  And THAT strikes me as
odd, given that India, by itself, has about a quarter of the world's
population and it has some of the world's largest cities.  And yet, in
the american data, there are values for Glace Bay, Goose Bay, Thunder
Bay, Whitehorse.  It seems strange that what are tiny little villages
are represented while such huge cities are not.

Oh well, that's just another thing in this world that doesn't make sense.

Thanks anyway,

Ted


Re: Timezone lookup?

2009-08-05 Thread Yitzchak Scott-Thoennes
On Wed, August 5, 2009 12:52 pm, Ted Byers wrote:
> Is there, in the various timezone packages, support somewhere for
> finding out what the timezone is for a given city/state?  I have, in my
> database, extensive data with the usual contact information from users
> from around the world.  If at all possible, I would like to query the data
> managed by one of the timezone packages to determine the local users'
> timezones from their mailing address.  Is this possible?  Using what?

For countries with a single timezone, you can look it up by iso3166 two
character code in %DateTime::TimeZone::Catalog::ZONES_BY_COUNTRY.

For other countries, I don't know of such support.  You can read the
comments in zone.tab or the longer comments in the region files in
the tzdata package at ftp://elsie.nci.nih.gov/pub/.




Timezone lookup?

2009-08-05 Thread Ted Byers
Is there, in the various timezone packages, support somewhere for
finding out what the timezone is for a given city/state?  I have, in
my database, extensive data with the usual contact information from
users from around the world.  If at all possible, I would like to
query the data managed by one of the timezone packages to determine
the local users' timezones from their mailing address.  Is this
possible?  Using what?

This data also has date and time stamps in UTC, and converting these
to whatever timezone is desired is easy to do using any of several
datetime packages I have tried.  But the problem remains to figure out
what time zone to use when ALL you have for a given person is his
mailing address.  Can that problem be solved?

Thanks

Ted