Uncomment the following line to install geemap if needed.
How to add local vector and raster data to the map with a few clicks¶
In [1]:
Copied!
# !pip install geemap
# !pip install geemap
In [2]:
Copied!
import os
import geemap
import os
import geemap
In [3]:
Copied!
# geemap.update_package()
# geemap.update_package()
Create an interactive map¶
In [4]:
Copied!
Map = geemap.Map()
Map
Map = geemap.Map()
Map
Out[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Download sample datasets¶
Note that geemap only supports vector data using WGS84 (EPSG:4326).
In [5]:
Copied!
out_dir = os.getcwd()
out_dir = os.getcwd()
In [6]:
Copied!
countries_url = "https://github.com/giswqs/data/raw/main/world/countries.zip"
us_states_url = (
"https://raw.githubusercontent.com/giswqs/data/main/us/us_states.geojson"
)
dem_url = (
'https://drive.google.com/file/d/1vRkAWQYsLWCi6vcTMk8vLxoXMFbdMFn8/view?usp=sharing'
)
landsat_url = (
'https://drive.google.com/file/d/1EV38RjNxdwEozjc9m0FcO3LFgAoAX1Uw/view?usp=sharing'
)
countries_url = "https://github.com/giswqs/data/raw/main/world/countries.zip"
us_states_url = (
"https://raw.githubusercontent.com/giswqs/data/main/us/us_states.geojson"
)
dem_url = (
'https://drive.google.com/file/d/1vRkAWQYsLWCi6vcTMk8vLxoXMFbdMFn8/view?usp=sharing'
)
landsat_url = (
'https://drive.google.com/file/d/1EV38RjNxdwEozjc9m0FcO3LFgAoAX1Uw/view?usp=sharing'
)
In [7]:
Copied!
geemap.download_from_url(countries_url)
geemap.download_from_url(countries_url)
Downloading https://github.com/giswqs/data/raw/main/world/countries.zip ... Unzipping countries.zip ... Data downloaded to: /home/runner/work/geospatial-notebooks/geospatial-notebooks/docs/geemap/countries
In [8]:
Copied!
geemap.download_from_url(us_states_url)
geemap.download_from_url(us_states_url)
Downloading https://raw.githubusercontent.com/giswqs/data/main/us/us_states.geojson ... Data downloaded to: /home/runner/work/geospatial-notebooks/geospatial-notebooks/docs/geemap/us_states.geojson
In [9]:
Copied!
geemap.download_from_gdrive(dem_url, 'dem.tif', unzip=False)
geemap.download_from_gdrive(dem_url, 'dem.tif', unzip=False)
Google Drive file id: 1vRkAWQYsLWCi6vcTMk8vLxoXMFbdMFn8 Downloading 1vRkAWQYsLWCi6vcTMk8vLxoXMFbdMFn8 into ./dem.tif... Done.
In [10]:
Copied!
geemap.download_from_gdrive(landsat_url, 'landsat.tif', unzip=False)
geemap.download_from_gdrive(landsat_url, 'landsat.tif', unzip=False)
Google Drive file id: 1EV38RjNxdwEozjc9m0FcO3LFgAoAX1Uw Downloading 1EV38RjNxdwEozjc9m0FcO3LFgAoAX1Uw into ./landsat.tif... Done.
Add data to the map using the toolbar¶
In [11]:
Copied!
Map
Map
Out[11]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Last update:
2022-03-14