Returns a precise timezone at the specific gps coordinates
Last updated 5 months ago by rainder .
ISC · Repository · Bugs · Original npm · Tarball
$ cnpm install @rainder/geo-tz 
SYNC missed versions from official npm registry.


It takes some time to load and preprocess shapefile, but once it's loaded it's super fast.

Note: both *.shp and *.dbf source files are required.


npm install @rainder/geo-tz


loadShapefile(filepath, options): Promise

options object

  //uses polygon minification algorithm 
  //by dropping points in the polygon.
  //WARNING: loses geometry precision if used
  minify: { //defaults to false
    //defines maximum amount of points in the polygon
    max_polygon_size: 150, 
    //precision step in meters
    precision_step: 100, 
  //defines geo indexing precision.
  //increasing value allows to find timezone faster, but uses more memory
  index_precision: 1,


Download timezone shape file

$ wget http://efele.net/maps/tz/world/tz_world.zip

Load shape file into the memory

const geoTimezone = require('@rainder/geo-tz')

geoTimezone.loadShapefile('./tz_world.shp').then((tz) => {
  const point = {
    type: 'Point',
    coordinates: [-0.15, 51.5]
  tz(point); //Europe/London
Maintainers (1)
Today 0
This Week 0
This Month 5
Last Day 0
Last Week 0
Last Month 11
Dependencies (3)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2018 © taobao.org |