-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added vector_to_gif function (#1348)
* Change jupyterlab dependency to optional * Added vector_to_gif function
- Loading branch information
Showing
6 changed files
with
496 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "12102773", | ||
"metadata": {}, | ||
"source": [ | ||
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/61_vector_to_gif.ipynb)\n", | ||
"[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder)\n", | ||
"\n", | ||
"**Creating animated GIF from vector data**\n", | ||
"\n", | ||
"Inspired by Johannes Uhl's [shapefile2gif](https://github.com/johannesuhl/shapefile2gif), I created a `vector_to_gif()` function in geemap that makes it much easier to create animated GIF from vector data with only one line of code.\n", | ||
"\n", | ||
"\n", | ||
"Uncomment the following line to install [geemap](https://geemap.org) if needed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3df89d34", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# !pip install -U geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5821afaf", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "17b0d275-56e9-470f-af27-8b9060905506", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = 'https://github.com/giswqs/data/raw/main/us/boulder_buildings.zip'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fc635d81", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"m = geemap.Map(center=[39.9898, -105.2532], zoom=14)\n", | ||
"m.add_vector(data, layer_name='Buildings')\n", | ||
"m" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f0daeb77-42b0-4130-8d7b-3154c60aba35", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"out_gif = 'buildings.gif'\n", | ||
"colname = 'year_built'\n", | ||
"title = 'Building Evolution in Boulder, Colorado, USA (1950-2015)'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "eac0fcdb-19c1-4547-be9b-c99829078114", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"geemap.vector_to_gif(\n", | ||
" data,\n", | ||
" out_gif,\n", | ||
" colname,\n", | ||
" vmin=1950,\n", | ||
" vmax=2015,\n", | ||
" step=10,\n", | ||
" facecolor='black',\n", | ||
" figsize=(10, 8),\n", | ||
" title=title,\n", | ||
" xy=('1%', '1%'),\n", | ||
" fontsize=20,\n", | ||
" progress_bar_color='blue',\n", | ||
" progress_bar_height=10,\n", | ||
" dpi=300,\n", | ||
" fps=10,\n", | ||
" mp4=False,\n", | ||
" verbose=True,\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "12102773", | ||
"metadata": {}, | ||
"source": [ | ||
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/61_vector_to_gif.ipynb)\n", | ||
"[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder)\n", | ||
"\n", | ||
"**Creating animated GIF from vector data**\n", | ||
"\n", | ||
"Inspired by Johannes Uhl's [shapefile2gif](https://github.com/johannesuhl/shapefile2gif), I created a `vector_to_gif()` function in geemap that makes it much easier to create animated GIF from vector data with only one line of code.\n", | ||
"\n", | ||
"\n", | ||
"Uncomment the following line to install [geemap](https://geemap.org) if needed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3df89d34", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# !pip install -U geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5821afaf", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "17b0d275-56e9-470f-af27-8b9060905506", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = 'https://github.com/giswqs/data/raw/main/us/boulder_buildings.zip'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fc635d81", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"m = geemap.Map(center=[39.9898, -105.2532], zoom=14)\n", | ||
"m.add_vector(data, layer_name='Buildings')\n", | ||
"m" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f0daeb77-42b0-4130-8d7b-3154c60aba35", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"out_gif = 'buildings.gif'\n", | ||
"colname = 'year_built'\n", | ||
"title = 'Building Evolution in Boulder, Colorado, USA (1950-2015)'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "eac0fcdb-19c1-4547-be9b-c99829078114", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"geemap.vector_to_gif(\n", | ||
" data,\n", | ||
" out_gif,\n", | ||
" colname,\n", | ||
" vmin=1950,\n", | ||
" vmax=2015,\n", | ||
" step=10,\n", | ||
" facecolor='black',\n", | ||
" figsize=(10, 8),\n", | ||
" title=title,\n", | ||
" xy=('1%', '1%'),\n", | ||
" fontsize=20,\n", | ||
" progress_bar_color='blue',\n", | ||
" progress_bar_height=10,\n", | ||
" dpi=300,\n", | ||
" fps=10,\n", | ||
" mp4=False,\n", | ||
" verbose=True,\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.