|
25 | 25 | "Then you'll need to make a new environment. These instructions are from [here](https://pydeck.gl/installation.html). \n",
|
26 | 26 | "\n",
|
27 | 27 | "+ Open the **Anaconda console** and make a new environment as follows:\n",
|
28 |
| - " conda create -n deck -c conda-forge pydeck jupyter\n", |
| 28 | + " \n", |
| 29 | + " `conda create -n deck -c conda-forge pydeck jupyter`\n", |
| 30 | + "\n", |
29 | 31 | "+ Next start the environment:\n",
|
30 |
| - " conda activate deck\n", |
| 32 | + "\n", |
| 33 | + " `conda activate deck`\n", |
| 34 | + "\n", |
31 | 35 | "+ Then issue these two commands:\n",
|
32 |
| - " jupyter nbextension install --sys-prefix --symlink --overwrite --py pydeck\n", |
33 |
| - " jupyter nbextension enable --sys-prefix --py pydeck\n", |
34 | 36 | "\n",
|
35 |
| - "That's it. You should be able to start a notebook as usual, this time in the `deck` environment, and the code below should work." |
| 37 | + " `jupyter nbextension install --sys-prefix --symlink --overwrite --py pydeck`\n", |
| 38 | + " \n", |
| 39 | + " `jupyter nbextension enable --sys-prefix --py pydeck`\n", |
| 40 | + "\n", |
| 41 | + "That's it. You should be able to start a notebook as usual, this time in the `deck` environment, and the code below should work. Note that the example may not work in VSCode---I think due to security settings of the HTML viewer (it's not insecure... all the data are local, it's some setting associated with 'cross-origin' resources)." |
36 | 42 | ]
|
37 | 43 | },
|
38 | 44 | {
|
|
55 | 61 | "metadata": {},
|
56 | 62 | "outputs": [],
|
57 | 63 | "source": [
|
58 |
| - "import pydeck" |
| 64 | + "import pydeck\n", |
| 65 | + "import string" |
59 | 66 | ]
|
60 | 67 | },
|
61 | 68 | {
|
|
82 | 89 | "outputs": [],
|
83 | 90 | "source": [
|
84 | 91 | "DATA_URL = \"tnames.json\"\n",
|
| 92 | + "chars = string.ascii_letters + \"āēīōūĀĒŌĪŪ1234567890/ \"\n", |
85 | 93 | "\n",
|
86 | 94 | "INITIAL_VIEW_STATE = pydeck.ViewState(\n",
|
87 | 95 | " latitude = -41,\n",
|
|
97 | 105 | " DATA_URL,\n",
|
98 | 106 | " opacity = 0.65,\n",
|
99 | 107 | " get_text = \"name\",\n",
|
100 |
| - " size_units = \"meter\",\n", |
| 108 | + " size_units = \"meters\",\n", |
101 | 109 | " get_size = 1000,\n",
|
102 | 110 | " size_max_pixels = 32,\n",
|
103 | 111 | " get_position = [\"lng\", \"lat\"],\n",
|
104 |
| - " get_color = 'reo > 0 ? [153, 0, 0] : [0, 0, 153]',\n", |
| 112 | + " get_color = 'reo > 0 ? [204, 0, 0] : [0, 0, 204]',\n", |
105 | 113 | " billboard = True,\n",
|
106 |
| - " character_set = pydeck.types.String(\n", |
107 |
| - " \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZāēīōūĀĒŌĪŪ1234567890/ \"),\n", |
| 114 | + " character_set = pydeck.types.String(chars),\n", |
108 | 115 | " font_family = pydeck.types.String(\"Times, serif\"),\n",
|
109 | 116 | " pickable = True\n",
|
110 | 117 | ")"
|
|
142 | 149 | "source": [
|
143 | 150 | "Because we are running this in a notebook we just get a locally viewable web page. If we run the code as a script we can also save to a web page.\n",
|
144 | 151 | "\n",
|
145 |
| - "I suggest experimenting with other options in the `pydeck.Layer()` constructor function. Also make sure to take a look at the generated HTML code (it's surprisingly simple, but it won't open in a browser again, because we generated it in a notebook).\n", |
| 152 | + "I suggest experimenting with other options in the `pydeck.Layer()` constructor function. Also make sure to take a look at the generated HTML code (it's surprisingly simple, but it won't open in a browser, because we generated it in a notebook).\n", |
146 | 153 | "\n",
|
147 | 154 | "Try visualising a different dataset, using a different deck layer format. For example, you can take a look at something simple like the California counties data from weeks ago, using the [GeoJsonLayer](https://deck.gl/docs/api-reference/layers/geojson-layer). You'll need to convert those files to GeoJSON format and also latitude-longitude format (EPSG code 4326)."
|
148 | 155 | ]
|
|
175 | 182 | "\n",
|
176 | 183 | "You can use [`kepler.gl`](https://kepler.gl/) to [make simple similar apps](https://southosullivan.com/misc/loi.html) without any code at all.\n",
|
177 | 184 | "\n",
|
178 |
| - "If you have to make a custom user interface, then there's no realy way to avoid... web development... and there aren't enough hours in the month to cover that in the context of this course. \n", |
| 185 | + "If you have to make a custom user interface, then there's no real way to avoid... web development... and there aren't enough hours in the month to cover that in the context of this course. \n", |
179 | 186 | "\n",
|
180 | 187 | "Suffice to say, web development is a field worth investing some time and energy in, especially if your interests lie in the direction of high interaction graphical applications."
|
181 | 188 | ]
|
182 | 189 | }
|
183 | 190 | ],
|
184 | 191 | "metadata": {
|
| 192 | + "interpreter": { |
| 193 | + "hash": "ebc44b48f8bab08f577aeb2e1dce152bdc30f81c7b302646e686ad24258b8930" |
| 194 | + }, |
185 | 195 | "kernelspec": {
|
186 | 196 | "display_name": "Python 3 (ipykernel)",
|
187 | 197 | "language": "python",
|
|
0 commit comments