Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
zyang91 committed Jun 2, 2024
1 parent 01d048f commit 0675c1d
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 0 deletions.
Binary file added notes/landsat.tif
Binary file not shown.
Binary file added notes/landsat_crs.tif
Binary file not shown.
297 changes: 297 additions & 0 deletions notes/lecture18.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,303 @@
"Map"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5141d888c730426cae8773f88089d9ee",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(bottom=25699.0, center=[37.47921744485059, -121.27807617187501], controls=(WidgetControl(options=['positio…"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"region = ee.Geometry.BBox(-122.5955, 37.5339, -122.0982, 37.8252)\n",
"fc = ee.FeatureCollection(region)\n",
"style = {'color': 'ffff00ff', 'fillColor': '00000000'}\n",
"Map.addLayer(fc.style(**style), {}, 'ROI')\n",
"Map"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# To local Drive\n",
"\n",
"not allow to direct download the whole Landsat images (file size too big)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generating URL ...\n",
"Downloading data from https://earthengine.googleapis.com/v1/projects/earthengine-legacy/thumbnails/0ebda04148d528623a64a61f25914a36-9e9344091f08ea472b011e35be23ecde:getPixels\n",
"Please wait ...\n",
"Data downloaded to c:\\Users\\zyang\\spatial_data_management\\notes\\landsat.tif\n"
]
}
],
"source": [
"geemap.ee_export_image(image, filename= 'landsat.tif', scale=30, region=region)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Projection"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{'type': 'Projection',\n",
" 'crs': 'EPSG:32610',\n",
" 'transform': [30, 0, 460785, 0, -30, 4264215]}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"projection = image.select(0).projection().getInfo()\n",
"projection"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"crs = projection['crs']\n",
"crs_transform = projection['transform']"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generating URL ...\n",
"Downloading data from https://earthengine.googleapis.com/v1/projects/earthengine-legacy/thumbnails/bd8458b905e1eb71a1c7ed508325e2e3-dfe046284f738d6ba418aa9ec836ecfe:getPixels\n",
"Please wait ...\n",
"Data downloaded to c:\\Users\\zyang\\spatial_data_management\\notes\\landsat_crs.tif\n"
]
}
],
"source": [
"geemap.ee_export_image(\n",
" image,\n",
" filename=\"landsat_crs.tif\",\n",
" crs=crs,\n",
" crs_transform=crs_transform,\n",
" region=region,\n",
")\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 0675c1d

Please sign in to comment.