<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet href="/rss.xsl" type="text/xsl" ?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Gmaps | Bacardi55&#39;s Web Cave</title>
    <link>https://bacardi55.io/tags/gmaps/</link>
    <description>Recent content in Gmaps on Bacardi55&#39;s Web Cave</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>bac@rdi55.pl (bacardi55)</managingEditor>
    <webMaster>bac@rdi55.pl (bacardi55)</webMaster>
    <copyright>2010-2025 bacardi55</copyright>
    <lastBuildDate>Sun, 19 Mar 2017 00:00:00 +0100</lastBuildDate>
    <atom:link href="https://bacardi55.io/tags/gmaps/index.xml" rel="self" type="application/rss+xml" />
    <item>
      
      <title>Kalliopé, what time is it in …</title><link>https://bacardi55.io/2017/03/19/kalliop%C3%A9-what-time-is-it-in/</link><pubDate>Sun, 19 Mar 2017 00:00:00 +0100</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2017/03/19/kalliop%C3%A9-what-time-is-it-in/</guid><description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;When you work with multiple country and different timezone, you&amp;rsquo;re&#xA;always wondering what time it is there&amp;hellip; And I was fed up to keep&#xA;opening a tab in a browser to find out again and again.&lt;/p&gt;&#xA;&lt;p&gt;So I decided to create a kalliopé neuron to be able to ask&#xA;&lt;a href=&#34;https://kalliope-project.github.io/&#34;&gt;kalliopé&lt;/a&gt; what time it is in any&#xA;city / country :) and I create the [wwtime&#xA;neuron]&lt;a href=&#34;https://github.com/bacardi55/kalliope-wwtime()&#34;&gt;https://github.com/bacardi55/kalliope-wwtime()&lt;/a&gt; to do so!&lt;/p&gt;&#xA;&lt;h2 id=&#34;how&#34;&gt;How&lt;/h2&gt;&#xA;&lt;h3 id=&#34;getting-timezone-for-address&#34;&gt;Getting timezone for address&lt;/h3&gt;&#xA;&lt;p&gt;This neuron will retrieve a local timezone and a requested city&#xA;timezone. It compares timezone difference (including summer time)&#xA;between the two location to give you the time there based on your&#xA;timezone.&lt;/p&gt;&#xA;&lt;p&gt;Eg:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am in Paris (GMT +1)&lt;/li&gt;&#xA;&lt;li&gt;I want to know Boston time (GMT -5 - and as of now - summer time (so 1&#xA;additional hour))&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When it&amp;rsquo;s 10pm in Paris, Kalliope will tell me it is 5pm in Boston&#xA;(because as of now, boston is in summer time and paris not yet, so -5&#xA;and not -6)&lt;/p&gt;&#xA;&lt;p&gt;It uses GoogleMaps API to get geolocation data based on a city name or&#xA;address. So you need to activate to Google API:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://developers.google.com/maps/documentation/timezone/intro&#34;&gt;Google Maps Time Zone API&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://developers.google.com/maps/documentation/geocoding/intro&#34;&gt;Google Maps Geocoding API&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;To make it works, you will need to get an API key on your&#xA;&lt;a href=&#34;https://console.developers.google.com/apis/dashboard&#34;&gt;developer console&lt;/a&gt;. Or follow &lt;a href=&#34;https://developers.google.com/maps/documentation/geocoding/get-api-key&#34;&gt;documentation here&lt;/a&gt; and &lt;a href=&#34;https://developers.google.com/maps/documentation/timezone/get-api-key&#34;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;installation&#34;&gt;Installation&lt;/h3&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      kalliope install --git-url https://github.com/bacardi55/kalliope-wwtimes.git&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;options&#34;&gt;Options&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;parameter&lt;/th&gt;&#xA;          &lt;th&gt;required&lt;/th&gt;&#xA;          &lt;th&gt;default&lt;/th&gt;&#xA;          &lt;th&gt;choices&lt;/th&gt;&#xA;          &lt;th&gt;comment&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;gmaps_api_key&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;          &lt;td&gt;string&lt;/td&gt;&#xA;          &lt;td&gt;The api key to use googlemaps API. See above.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;local&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;          &lt;td&gt;string&lt;/td&gt;&#xA;          &lt;td&gt;Your city/address to compare time difference with&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;city&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;          &lt;td&gt;string&lt;/td&gt;&#xA;          &lt;td&gt;What city/address where you want to know time&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;return-values&#34;&gt;Return Values&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Name&lt;/th&gt;&#xA;          &lt;th&gt;Description&lt;/th&gt;&#xA;          &lt;th&gt;Type&lt;/th&gt;&#xA;          &lt;th&gt;sample&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;status&lt;/td&gt;&#xA;          &lt;td&gt;Response status&lt;/td&gt;&#xA;          &lt;td&gt;String&lt;/td&gt;&#xA;          &lt;td&gt;OK or KO&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;city&lt;/td&gt;&#xA;          &lt;td&gt;A dict¹ (see below)&lt;/td&gt;&#xA;          &lt;td&gt;dict&lt;/td&gt;&#xA;          &lt;td&gt;[arg: &amp;rsquo;new york city&amp;rsquo;, &amp;rsquo;timezoneid&amp;rsquo;: &amp;lsquo;America/New_York&amp;rsquo;, &amp;rsquo;timezonename&amp;rsquo;: &amp;lsquo;Eastern Daylight Time&amp;rsquo;, time: {&amp;lsquo;hour&amp;rsquo;: &amp;lsquo;10&amp;rsquo;, &amp;lsquo;minute&amp;rsquo;: &amp;lsquo;30&amp;rsquo;}]&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;local&lt;/td&gt;&#xA;          &lt;td&gt;A dict¹ (see below)&lt;/td&gt;&#xA;          &lt;td&gt;dict&lt;/td&gt;&#xA;          &lt;td&gt;[arg: &amp;lsquo;Paris France&amp;rsquo;, &amp;rsquo;timezoneid&amp;rsquo;: &amp;lsquo;Europe/Paris&amp;rsquo;, &amp;rsquo;timezonename&amp;rsquo;: &amp;lsquo;Central European Standard Time&amp;rsquo;, time: {&amp;lsquo;hour&amp;rsquo;: &amp;lsquo;10&amp;rsquo;, &amp;lsquo;minute&amp;rsquo;: &amp;lsquo;30&amp;rsquo;}]&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;¹: these dict contains:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;arg: The given name in arguments (equals &amp;rsquo;local&amp;rsquo; argument for local&#xA;return variable or &amp;lsquo;city&amp;rsquo; arguments for city return variable)&lt;/li&gt;&#xA;&lt;li&gt;timezoneid: The ID of the timezone, eg: Europe/Paris&lt;/li&gt;&#xA;&lt;li&gt;timezonename: The name of the timezone eg: Central European Standard&#xA;Time&lt;/li&gt;&#xA;&lt;li&gt;time, a dict containing &amp;lsquo;hour&amp;rsquo; and &amp;lsquo;minutes&amp;rsquo;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;synapses-example&#34;&gt;Synapses example&lt;/h2&gt;&#xA;&lt;h3 id=&#34;brains&#34;&gt;brains&lt;/h3&gt;&#xA;&lt;p&gt;Get a city by argument in order&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - name: &amp;#34;Wwtime-city&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        signals:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - order: &amp;#34;what time is it in {{city}}&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        neurons:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - wwtime:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              gmaps_api_key: &amp;#34;{{gmaps_api_key}}&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              local: &amp;#34;Paris France&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              args:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                - city&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              file_template: &amp;#34;templates/fr_wwtime.j2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Get a city by argument set in brain:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - name: &amp;#34;Wwtime-city-boton&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        signals:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - order: &amp;#34;heure boston&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        neurons:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - wwtime:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              gmaps_api_key: &amp;#34;{{gmaps_api_key}}&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              city: &amp;#34;boston MA&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              local: &amp;#34;Paris France&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              file_template: &amp;#34;templates/fr_wwtime.j2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;template&#34;&gt;template&lt;/h3&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {% raw %}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {% if status == &amp;#34;OK&amp;#34; %}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Sir, in {{city.arg}}, it is {{city.time.hour}} hour and {{city.time.minute}} minutes, whereas here, it&amp;#39;s {{local.time.hour}} hour and {{local.time.minute}} minutes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Le timezone est {{city.timezonename}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {% else %}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Sorry sir, but I don&amp;#39;t know&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {% endif %}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {% endraw %}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;see more example in the &lt;a href=&#34;https://github.com/bacardi55/kalliope-wwtime/blob/master/samples/&#34;&gt;sample directory&lt;/a&gt;&lt;/p&gt;&#xA;</description></item>
  </channel>
</rss>
