61 vector to gif
Creating animated GIF from vector data
Inspired by Johannes Uhl's shapefile2gif, I created a vector_to_gif()
function in leafmap that makes it much easier to create animated GIF from vector data with only one line of code. The sample dataset used in this notebook is a subset of the dataset retrieved from the shapefile2gif repo. Credits to Johannes Uhl. For more information about the datasets, check out the references below:
- Uhl, Johannes H; Leyk, Stefan (2022), "MTBF-33: A multi-temporal building footprint dataset for 33 counties in the United States (1900–2015)", Data in Brief, 43, 108369. DOI: 10.1016/j.dib.2022.108369
- Uhl, Johannes H; Leyk, Stefan (2022), “MTBF-33: A multi-temporal building footprint dataset for 33 U.S. counties at annual resolution (1900-2015)”, Mendeley Data, V2. DOI: 10.17632/w33vbvjtdy.2
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install -U leafmap
# !pip install -U leafmap
In [2]:
Copied!
import leafmap
import leafmap
In [3]:
Copied!
# A subset of the dataset retrieved from https://github.com/johannesuhl/shapefile2gif
url = "https://opengeos.org/data/us/boulder_buildings.zip"
data = leafmap.download_file(url, unzip=False)
# A subset of the dataset retrieved from https://github.com/johannesuhl/shapefile2gif
url = "https://opengeos.org/data/us/boulder_buildings.zip"
data = leafmap.download_file(url, unzip=False)
Downloading... From: https://opengeos.org/data/us/boulder_buildings.zip To: /home/runner/work/leafmap/leafmap/docs/notebooks/boulder_buildings.zip
0%| | 0.00/1.77M [00:00<?, ?B/s]
100%|██████████| 1.77M/1.77M [00:00<00:00, 50.5MB/s]
In [4]:
Copied!
m = leafmap.Map(center=[39.9898, -105.2532], zoom=14)
m.add_vector(data, layer_name="Buildings")
m
m = leafmap.Map(center=[39.9898, -105.2532], zoom=14)
m.add_vector(data, layer_name="Buildings")
m
Out[4]: