diff --git a/notes/landsat.tif b/notes/landsat.tif new file mode 100644 index 0000000..78321ad Binary files /dev/null and b/notes/landsat.tif differ diff --git a/notes/landsat_crs.tif b/notes/landsat_crs.tif new file mode 100644 index 0000000..78321ad Binary files /dev/null and b/notes/landsat_crs.tif differ diff --git a/notes/lecture18.ipynb b/notes/lecture18.ipynb index b4b8a83..ee7745c 100644 --- a/notes/lecture18.ipynb +++ b/notes/lecture18.ipynb @@ -87,6 +87,303 @@ "Map" ] }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "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", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "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", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "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", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "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", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "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,