Skip to content

Installation of missing notebook renderer does not trigger output re-render #157689

Closed

Description

@rebornix
Sample notebook: Click to expand!
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# With the release of IPython 6 (coming April 2017), there's a GeoJSON display class that allows you to visualize GeoJSON data quickly.\n",
    "# from IPython.display import GeoJSON\n",
    "# In the meantime...\n",
    "from IPython.display import display\n",
    "def GeoJSON(data, **kwargs):\n",
    "    bundle = {\n",
    "        'application/geo+json': data,\n",
    "        'text/plain': ''\n",
    "    }\n",
    "    metadata = {\n",
    "        'application/geo+json': kwargs\n",
    "    }\n",
    "    display(bundle, metadata=metadata, raw=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "data = {\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"place\":\"The coffee bar\",\"login\":\"espresso\",\"lat\":\"38.91427\",\"lon\":\"-77.02827\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.02827,38.91427]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Bistro Bohem\",\"login\":\"2027355895\",\"lat\":\"38.91538\",\"lon\":\"-77.02013\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.02013,38.91538]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Black Cat\",\"login\":\"luckycat\",\"lat\":\"38.91458\",\"lon\":\"-77.03155\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.03155,38.91458]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Snap\",\"login\":\"nutella1\",\"lat\":\"38.92239\",\"lon\":\"-77.04227\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.04227,38.92239]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Columbia Heights Coffee\",\"login\":\"FAIRTRADE1\",\"lat\":\"38.93222\",\"lon\":\"-77.02854\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.02854,38.93222]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Azi's Cafe\",\"login\":\"sunny\",\"lat\":\"38.90842\",\"lon\":\"-77.02419\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.02419,38.90842]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Blind Dog Cafe\",\"login\":\"baxtercantsee\",\"lat\":\"38.91931\",\"lon\":\"-77.02518\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.02518,38.91931]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Le Caprice\",\"login\":\"baguette\",\"lat\":\"38.93260\",\"lon\":\"-77.03304\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.03304,38.9326]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Filter\",\"login\":\"\",\"lat\":\"38.91368\",\"lon\":\"-77.04509\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.04509,38.91368]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Peregrine\",\"login\":\"espresso\",\"lat\":\"38.88516\",\"lon\":\"-76.99656\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-76.99656,38.88516]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Tryst\",\"login\":\"coupetnt\",\"lat\":\"38.921894\",\"lon\":\"-77.042438\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.042438,38.921894]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"The Coupe\",\"login\":\"voteforus\",\"lat\":\"38.93206\",\"lon\":\"-77.02821\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.02821,38.93206]}},{\"type\":\"Feature\",\"properties\":{\"place\":\"Big Bear Cafe\",\"login\":\"\",\"lat\":\"38.91275\",\"lon\":\"-77.01239\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-77.01239,38.91275]}}]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "application/geo+json": {
       "features": [
        {
         "geometry": {
          "coordinates": [
           -77.02827,
           38.91427
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.91427",
          "login": "espresso",
          "lon": "-77.02827",
          "place": "The coffee bar"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.02013,
           38.91538
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.91538",
          "login": "2027355895",
          "lon": "-77.02013",
          "place": "Bistro Bohem"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.03155,
           38.91458
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.91458",
          "login": "luckycat",
          "lon": "-77.03155",
          "place": "Black Cat"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.04227,
           38.92239
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.92239",
          "login": "nutella1",
          "lon": "-77.04227",
          "place": "Snap"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.02854,
           38.93222
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.93222",
          "login": "FAIRTRADE1",
          "lon": "-77.02854",
          "place": "Columbia Heights Coffee"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.02419,
           38.90842
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.90842",
          "login": "sunny",
          "lon": "-77.02419",
          "place": "Azi's Cafe"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.02518,
           38.91931
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.91931",
          "login": "baxtercantsee",
          "lon": "-77.02518",
          "place": "Blind Dog Cafe"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.03304,
           38.9326
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.93260",
          "login": "baguette",
          "lon": "-77.03304",
          "place": "Le Caprice"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.04509,
           38.91368
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.91368",
          "login": "",
          "lon": "-77.04509",
          "place": "Filter"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -76.99656,
           38.88516
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.88516",
          "login": "espresso",
          "lon": "-76.99656",
          "place": "Peregrine"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.042438,
           38.921894
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.921894",
          "login": "coupetnt",
          "lon": "-77.042438",
          "place": "Tryst"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.02821,
           38.93206
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.93206",
          "login": "voteforus",
          "lon": "-77.02821",
          "place": "The Coupe"
         },
         "type": "Feature"
        },
        {
         "geometry": {
          "coordinates": [
           -77.01239,
           38.91275
          ],
          "type": "Point"
         },
         "properties": {
          "lat": "38.91275",
          "login": "",
          "lon": "-77.01239",
          "place": "Big Bear Cafe"
         },
         "type": "Feature"
        }
       ],
       "type": "FeatureCollection"
      }
     },
     "metadata": {
      "application/geo+json": {}
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "GeoJSON(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/geo+json": {
       "geometry": {
        "coordinates": [
         11.8,
         -45.04
        ],
        "type": "Point"
       },
       "type": "Feature"
      }
     },
     "metadata": {
      "application/geo+json": {
       "layer_options": {
        "attribution": "NASA/MOLA",
        "basemap_id": "mola-color",
        "maxZoom": 6,
        "minZoom": 0,
        "tms": true
       },
       "url_template": "http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "GeoJSON(data={\n",
    "    \"type\": \"Feature\",\n",
    "    \"geometry\": {\n",
    "        \"type\": \"Point\",\n",
    "        \"coordinates\": [11.8, -45.04]\n",
    "    }\n",
    "}, url_template=\"http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png\", \n",
    "layer_options={\n",
    "    \"basemap_id\": \"mola-color\",\n",
    "    \"attribution\" : \"NASA/MOLA\",\n",
    "    \"tms\": True,\n",
    "    \"minZoom\" : 0,\n",
    "    \"maxZoom\" : 6\n",
    "})"
   ]
  }
 ],
 "metadata": {
  "kernel_info": {
   "name": "python3"
  },
  "kernelspec": {
   "display_name": "Python 3.9.1 ('testenv')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.1"
  },
  "nteract": {
   "version": "[email protected]"
  },
  "title": "Explore Your World with GeoJSON",
  "vscode": {
   "interpreter": {
    "hash": "4d5635b0b8a841083442f7889d671998dbd6678a60d22fe59973c664c8ca3f0b"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}

Activity

  1. added a commit that references this issue on Aug 9, 2022
    f53db0f
  2. added a commit that references this issue on Aug 9, 2022
    06f2a63
  3. added a commit that references this issue on Aug 10, 2022
    d4170a7
  4. added
    verification-needed
    on Aug 19, 2022
  5. rzhao271 commented on Aug 26, 2022

    @rzhao271
    Collaborator
    1. I have to manually set the presentation to application/geo+json every time I run the cell when I don't yet have the proper notebook renderer installed.
    2. The recommended extension is RandomFractalsInc.vscode-data-table. I don't get ms-toolsai.jupyter-renderers recommended.

    Other than that, I do get a re-render after installing RandomFractalsInc.vscode-data-table.

  6. locked and limited conversation to collaborators on Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

notebook-outputpolishverification-neededverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions