<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Univers Libre - dev</title>
    <subtitle>Yet another sysadmin&#39;s personal blog</subtitle>
    <link rel="self" type="application/atom+xml" href="https://univers-libre.net/tags/dev/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://univers-libre.net"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2019-01-05T02:29:02+00:00</updated>
    <id>https://univers-libre.net/tags/dev/atom.xml</id>
    <entry xml:lang="en">
        <title>Patinoires de Montréal et données ouvertes</title>
        <published>2019-01-05T02:29:02+00:00</published>
        <updated>2019-01-05T02:29:02+00:00</updated>
        
        <author>
          <name>Romain</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://univers-libre.net/posts/patinoires-montreal/"/>
        <id>https://univers-libre.net/posts/patinoires-montreal/</id>
        
        <content type="html" xml:base="https://univers-libre.net/posts/patinoires-montreal/">&lt;p&gt;Dernièrement je me suis amusé à exploiter les données ouvertes que la ville de Montréal maintient sur les conditions de glace des patinoires publiques.&lt;/p&gt;
&lt;p&gt;L’état de chaque patinoire est indiqué sur le &lt;a class=&quot;external-link&quot; rel=&quot;external&quot; href=&quot;https://ville.montreal.qc.ca/portal/page?_pageid=5798,94909650&amp;amp;_dad=portal&amp;amp;_schema=PORTAL&quot;&gt;site de la ville&lt;/a&gt;. Un fichier XML mis à jour quasi-quotidiennement durant la saison peut être trouvé &lt;a class=&quot;external-link&quot; rel=&quot;external&quot; href=&quot;https://donnees.ville.montreal.qc.ca/dataset/patinoires&quot;&gt;ici&lt;/a&gt;, les données sont sous licence Creative Common BY 4.0.&lt;/p&gt;
&lt;p&gt;L’idée était de pouvoir vérifier les conditions plus simplement que d’ouvrir mon navigateur, en une seule commande. Voici donc &lt;a class=&quot;external-link&quot; rel=&quot;external&quot; href=&quot;https://gitlab.com/billux/patinoires-mtl&quot;&gt;patinoires-mtl&lt;/a&gt;. Les cas d’usage sont mis en exemple dans le README : lister les patinoires ouvertes, afficher les conditions d’une ou plusieurs patinoires et, bonus, une sous-commande watch qui retourne les conditions seulement si elles ont changées, ce qui me permet d’envoyer ça à &lt;code&gt;mail&lt;/code&gt; ou sendxmpp&lt;code&gt;et à mettre en&lt;/code&gt;cron` pour être alerté dès qu’il y a un changement.&lt;/p&gt;
&lt;p&gt;Lister les patinoires ouvertes :&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./patinoire.py list --open&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Skating rink                                          Open&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;----------------------------------------------------  ----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire Bleu Blanc Bouge du parc Hayward (PSE)      1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire Bleu-Blanc-Bouge, Parc Confédération (PSE)  1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire réfrigérée, Lac aux Castors (PP)            1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Lister les patinoires du Plateau-Mont-Royal :&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./patinoire.py list --borough pmr&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Skating rink                                           Open&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------------------  ----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Grande patinoire avec bandes, La Fontaine (PSE)        0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire avec bandes, Baldwin (PSE)                   0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire avec bandes, Jeanne-Mance (PSE)              0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire avec bandes, Sir-Wilfrid-Laurier no 1 (PSE)  0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire avec bandes, Sir-Wilfrid-Laurier no 2 (PSE)  0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire avec bandes, Sir-Wilfrid-Laurier no 3 (PSE)  0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire De Gaspé/Bernard (PSE)                       0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire de patin libre, Baldwin (PPL)                0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire de patin libre, Jeanne-Mance (PPL)           0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire de patin libre, Sir-Wilfrid-Laurier (PPL)    0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire décorative, De Lorimier (PP)                 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire décorative, La Fontaine (PP)                 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Afficher les conditions d’une patinoire en particulier :&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./patinoire.py conditions &amp;quot;lac aux castors&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                            Open  Cleared  Sprayed  Resurfaced  Condition   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;------------------------------------------  ----  -------  -------  ----------  ----------  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire réfrigérée, Lac aux Castors (PP)  1     1        1        1           Excellente &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et une fonction pratique, pour être notifié d’un changement de condition sur une patinoire :&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./patinoire.py watch &amp;quot;lac aux castors&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                            Open  Cleared  Sprayed  Resurfaced  Condition&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;------------------------------------------  ----  -------  -------  ----------  ----------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire réfrigérée, Lac aux Castors (PP)  1     1        1        1           Excellente&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Updated on 2018-12-08 09:05:28&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./patinoire.py watch &amp;quot;lac aux castors&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[a few days later]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ./patinoire.py watch &amp;quot;lac aux castors&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                            Open  Cleared  Sprayed  Resurfaced  Condition&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;------------------------------------------  ----  -------  -------  ----------  ----------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patinoire réfrigérée, Lac aux Castors (PP)  1     1        1        1           Bonne&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Updated on 2018-12-10 09:03:56&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Comme j’adore les cartes, j’ai aussi fait &lt;a class=&quot;external-link&quot; rel=&quot;external&quot; href=&quot;https://gitlab.com/billux/patinoires-mtl-leaflet&quot;&gt;patinoires-mtl-leaflet&lt;/a&gt;, qui permet de geolocaliser toutes les patinoires de Montréal sur un fond de carte OpenStreetMap et d’afficher leur état. Bon pour le coup, c’est de nouveau dans le navigateur forcement… La couleur des patinoires est en fonction de leur état. Un aperçu ici : &lt;a class=&quot;external-link&quot; rel=&quot;external&quot; href=&quot;https://univers-libre.net/patinoires-mtl/&quot;&gt;https://univers-libre.net/patinoires-mtl/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Pour la géolocalisation des patinoires, la ville de Montréal ne fournit aucune données. OpenStreetMap ne contient que très peu de patinoires non plus, et ça allait être compliqué de faire correspondre les noms des patinoires du XML de la ville avec ceux dans OpenStreetMap de toute façon. C’est alors que je suis tombé sur une &lt;a class=&quot;external-link&quot; rel=&quot;external&quot; href=&quot;https://gitlab.com/mudar-ca/PatinerMontreal-Android&quot;&gt;application Android&lt;/a&gt; qui fait à peu près la même chose et qui a un fichier geojson avec la géolocalisation de toutes les patinoires. Rien n’est indiqué concernant la licence ou la provenance de ces données par contre.&lt;/p&gt;
&lt;p&gt;L’outil en ligne de commande est en anglais et la carte est en français, ça ne fait aucune cohérence et comme ça tout le monde/personne (n’)est content.&lt;/p&gt;
&lt;p&gt;Je ne pense pas y faire d’autres modifications à part rajouter probablement la même chose pour les conditions des pistes de ski de fond.&lt;/p&gt;
</content>
        
    </entry>
</feed>
