Skip to content

Fast, daylight-saving-aware timezone lookup from world-wide lat/long

Notifications You must be signed in to change notification settings

LucaFoschini/FastTZWhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

FastTZWhere

Offline, fast, daylight-saving-aware timezone lookup from world-wide lat/long.

Answer the question "What was the local time in Bologna exactly 3 years ago?"

Put another way, computes the (Daylight Saving-aware) timezone from a lat/long geolocation.

It doesn't require an internet connection (except for the first time your run it, when the Olson Database needs to be downloaded)

Inspired by: pytzwhere, with the following improvements:

  • Daylight Saving Time is taken into consideration (through pytz)
  • Reverse geolocation is very fast (based on RTree and libspatialindex)
  • Uses Fiona/Shapely(Python GIS) to deal with shapefiles.
  • Batteries included. The class initialization takes care of retrieving the necessary external information

Installation

Install libspatialindex). On a mac:

   wget http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.1.tar.gz
   tar -xzvf spatialindex-src-1.8.1.tar.gz 
   cd spatialindex-src-1.8.1
   ./configure; make; make install

Install the rest of the requirements:

   pip install -r requirements.txt

Run

python FastTZWhere.py

The first time you'll see

   Downloading the TZ shapefile (Olson database)...
   Done.
   Building the spatial index on the shapefile...
   Done.
   UTC+0200
   UTC+0100

All the other times:

   Loading Rtree and Pickle File
   UTC+0200
   UTC+0100

About

Fast, daylight-saving-aware timezone lookup from world-wide lat/long

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages