Giter Site home page Giter Site logo

leaflet.timezones's Introduction

Leaflet.timezones

Overlay timezones on a Leaflet Earth map.

Demo https://dj0001.github.io/Leaflet.timezones/

Usage

Leaflet.timezones extends the GeoJSON class. Adding the sunset to a leaflet popup is as easy as:

L.timezones.addTo(map);

with timezone popup:

L.timezones.bindPopup(function (layer) {
    return layer.feature.properties.time_zone;
}).addTo(map);

with worldclock popup:

L.timezones.bindPopup(function (layer) {
    return new Date().toLocaleString("en-GB", {timeZone:layer.feature.properties.tz_name1st, timeZoneName:"short"})
}).addTo(map);

This project is licensed under the terms of the MIT license.

leaflet.timezones's People

Contributors

dj0001 avatar jasonwinget avatar

Stargazers

Jason Willems avatar Kevin Novak avatar Karly Nelson avatar Jinghao Hu avatar Anton Verinov avatar Anderson Campos avatar Connor Dillon avatar  avatar Gordon avatar  avatar  avatar  avatar Michaël avatar 斌临城下 avatar Kris Haamer avatar Miłosz Kosobucki avatar

Watchers

James Cloos avatar  avatar

leaflet.timezones's Issues

Here is how you update the timezones

This package was last updated 7 years ago. A lot of timezones have changed since then. Here is how to get the latest data:

  1. Go to the evansiroky/timezone-boundary-builder and download the latest timezones-with-oceans.geojson.zip.

  2. Unzip the file and use mapshaper.org to simplify the geoJson file. Otherwise it will be way too big. Here are instructions.

  3. Export the simplified geoJson file and replace the geoJson data in this file: https://github.com/dj0001/Leaflet.timezones/blob/master/L.timezones.js

Then you're good to go!

Note: After doing this, the popup will not display the correct time. You need to add the timezone offset as an attribute on the each geoJson object.

help

Can you add a control, turn it on when you need it, and turn it off when you don't need it.

License is not known

Hey,

first of all, thanks for the nice plugin!

I'd like to use it in our project. Can you clarify what's the license of the code?

Thanks!

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.