4

I have about 5,000 weather stations with its' lat, lon coordinates.

I would like to determine which Time Zone they fit into and whether they observe daylight savings time.

The sample of data looks as follows:

Austin, TX: 30.183, -97.68, US Central Time, DST = Yes
Phoenix, AZ: 33.3, -111.667, US Mountain Time, DST = No

I'm only interested in the US, Canada, and Mexico.

Any and all ideas are appreciated. I'm opening to writing code to calculate this, but would prefer if there is some open dataset that may already exist that I could reuse.

  • 2
    I highly recommend you to ask this question on GIS SE | Ask a question. But, please consider some specifications, e.g. data format which you obey, software which you can access, and what export format do you require? For instance, I have a CSV file, I can some QGIS/ArcGIS or nothing, I need a map or a table output etc. – Taras Dec 28 '18 at 15:55
6

Glad you figured out a solution. I was almost done writing this answer when you posted yours, so here's another way:

  1. Download and install QGIS, which is a free GIS program.
  2. Import your point data into QGIS as a CSV (tutorial).
  3. Obtain timezones in a geospatial format (eg from here or here) and import into QGIS.
  4. Run a spatial join between the point layer and the timezones.
  5. Export the joined layer in CSV format.
4

So I was able to get this information for almost all my weather stations by using the GeoNames.org service:

http://www.geonames.org/export/web-services.html#timezone

Using one of my examples:

http://api.geonames.org/timezone?lat=30.183&lng=-97.68&username=demo

returns the following XML block:

<geonames>
<timezone tzversion="tzdata2018g">
<countryCode>US</countryCode>
<countryName>United States</countryName>
<lat>30.183</lat>
<lng>-97.68</lng>
<timezoneId>America/Chicago</timezoneId>
<dstOffset>-5.0</dstOffset>
<gmtOffset>-6.0</gmtOffset>
<rawOffset>-6.0</rawOffset>
<time>2018-12-28 12:53</time>
<sunrise>2018-12-28 07:25</sunrise>
<sunset>2018-12-28 17:38</sunset>
</timezone>
</geonames>

For more than a small number of requests, I needed to sign up for a free account, but I was able to write a script to download more than 9,000 locations overnight.

A JSON API is also available.

  • 1
    You can also download the geonames.org database in its entirety. – Barry Carter Dec 29 '18 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.