Weather worldwide onclick

Where you have to start, when you want to make weather forecast app, is to find out the coordinates.
Since map Api provides these coordinates, this question is solved, but you have to know exact time in the location, where you want to show weather. Most obvious idea is to use toLocaleString("en-US", options), limit output in options to hours and use this for your app.

const hours = new Date();
const options = {
timeZone:"America/New_York",
//weekday: "long",
 // year: "numeric",
hourCycle:"h24",
hour:"numeric"
};
hours.toLocaleString("en-US", options);
This obvious approach though will return something like '05' for New York, which will have to be proceeded somehow for futher use.

There are services that provide time for selected coordinates, but there is a much simpler solution. We know that each 15 grades latitude adds 1 hour to location time zone.
If we just divide latitude by 15 , we are about to get time difference of the clicked location with standard time, that we can obtain with js function:getUTCHours()
Now we have coordinates and localtime. After that we can ask weather provider api for weather reading for this place and time.
Below I have a map, where you can find ou weather on click whatever location you select.

Code snippets

  • Image Canvas Mask
    Canvas Mask Images
  • Image Appointmets calendar
    Add appointments calendar
  • Image Use QR-Codes on your site
    Generate unique QR-codes
  • Image Particles Repeller
    Particles repeller snippet
  • Image Welcome Your Guests
    Welcome your guests
  • Image Star Snippet
    Burning star canvas snippet
  • Image Rounded Corners
    Add rounded corners to layers
  • Image Google Icons
    Visualize information
  • Image Circle of Light
    Light moving in a circle
  • Image Colors Palette
    Color select palette script
  • Image Particles interaction
    Angular velocity, center gravity
  • Image Animating Mask
    Animating image mask on canvas
  • Image Animating Mask 2
    Animating image mask version 2
  • Image Particles to Mouse
    Random particles following mouse
  • Image Particles to Mouse 2
    Random particles following mouse
  • Image Center Attraction
    Random particles attracted to center
  • Image Mutual Attraction
    Mutual attraction of elements
  • Image Image Map
    Clickable example of image map
  • Image Using Shape
    Using curved shape outlines
  • Image Animate SVG
    Animating SVG Filters
  • Image Conversion
    Calculating conversion
  • Image Weather Online
    Weather vidjet for website
  • Image Weather worldwide
    Weather worldwide onclick