Giter Club home page Giter Club logo

pytzwhere's Introduction

pytzwhere Build Status Coverage Status

pytzwhere is a Python library to lookup the timezone for a given lat/lng entirely offline.

Version 3.0 fixes how pytzwhere deals with holes in timezones. It is recommended that you use version 3.0.

It is a port from https://github.com/mattbornski/tzwhere with a few improvements. The underlying timezone data is based on work done by Eric Muller

If used as a library, basic usage is as follows:

>>> from tzwhere import tzwhere
>>> tz = tzwhere.tzwhere()
>>> print tz.tzNameAt(35.29, -89.66)
America/Chicago

The polygons used for building the timezones are based on VMAP0. Sometimes points are outside a VMAP0 polygon, but are clearly within a certain timezone (see also this discussion). As a solution you can search for the closest timezone within a user defined radius.

Dependencies:

  • numpy (optional)

  • shapely

forceTZ

If the coordinates provided are outside of the currently defined timezone boundaries, the tzwhere function will return None. If you would like to match to the closest timezone, use the forceTZ parameter.

Example:

>>> from tzwhere import tzwhere
>>> tz = tzwhere.tzwhere()
>>> print(tz.tzNameAt(53.68193999999999, -6.239169999999998))
None

>>> from tzwhere import tzwhere
>>> tz = tzwhere.tzwhere(forceTZ=True)
>>> print(tz.tzNameAt(53.68193999999999, -6.239169999999998, forceTZ=True))
Europe/Dublin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.