# TzWorld

Resolve timezones from a location efficiently using PostGIS and Ecto ([documentation](

`TzWorld` works by fetching timezone GeoJson data from [this project](, and then inserting it in a PostGIS table. Once populated, the database can be queried to retrieve a timezone name from coordinates.

## Installation

1. Add `tz_world` to your list of dependencies in `mix.exs`:
def deps do
    {:tz_world, "~> 0.1.0"}
After adding TzWorld as a dependency, run `mix deps.get` to install it.

2. Set your Ecto repository in your `config.ex`:
config :tz_world,
  repo: MyApp.Repo

3. If you haven't already done so, add the `Geo.PostGIS` Ecto [extension]( to your project
# Create a new file anywhere in your application with the following:
                      [Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(),
                      json: Poison)


4. Generate the migration to create the PostGIS table that will hold the GeoJson data:
$ mix tz_world.gen.migration
Then run the migration with `mix ecto.migrate`.

5. Populate the table:
$ mix tz_world.install
This will Fetch GeoJson data from [here](, and insert it your database.

## Usage

TzWorld.timezone_at(%Geo.Point{coordinates: {3.2, 45.32}})