Skip to content

Instantly share code, notes, and snippets.

@giswqs
Created November 14, 2020 01:26
Show Gist options
  • Select an option

  • Save giswqs/e1e97863f19c48684a75329023264c3e to your computer and use it in GitHub Desktop.

Select an option

Save giswqs/e1e97863f19c48684a75329023264c3e to your computer and use it in GitHub Desktop.
download landsat
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "import ee\nimport geemap",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "Map = geemap.Map()\nMap",
"execution_count": 2,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Map(center=[40, -100], controls=(WidgetControl(options=['position'], widget=HBox(children=(ToggleButton(value=…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "16b75a79bdb84da89cc6480f608c856f"
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "point = ee.Geometry.Point([-122.440504, 37.758213])\nim = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') \\\n .filterBounds(point) \\\n .filterDate('2018-01-01', '2018-12-31') \\\n .sort('CLOUD_COVER') \\\n .first() \\\n .select(['B4','B3','B2'])",
"execution_count": 3,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "Map.addLayer(im, {'min': 0, 'max': 3000},'image')\nMap.centerObject(point, 7)",
"execution_count": 4,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "import os\nout_dir = os.path.join(os.path.expanduser('~'),'Downloads')\nfilename = os.path.join(out_dir,'test.tif')\ngeemap.ee_export_image(im, filename=filename, scale=160, file_per_band=False)",
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"text": "Generating URL ...\nDownloading data from https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/5000a25a368f7d294a47891ae6c17466-f498ec3b73cfd0945e6fdd229168a42f:getPixels\nPlease wait ...\nData downloaded to /home/qiusheng/Downloads/test.tif\n",
"name": "stdout"
}
]
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.8.5",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"base_numbering": 1,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"gist": {
"id": "",
"data": {
"description": "download landsat",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment