forked from gee-community/geemap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request gee-community#1112 from giswqs/fishnet
Added fishnet function gee-community#1111
- Loading branch information
Showing
8 changed files
with
432 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<a href=\"https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/117_fishnet.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\"/></a>\n", | ||
"\n", | ||
"**Creating a fishnet based on an input vector dataset**\n", | ||
"\n", | ||
"Uncomment the following line to install [geemap](https://geemap.org) if needed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# !pip install -U geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ee\n", | ||
"import geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Map = geemap.Map()\n", | ||
"Map" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Simply draw a rectangle or polyon on the map use to used as an ROI. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = Map.user_roi\n", | ||
"\n", | ||
"if data is None:\n", | ||
" data = ee.Geometry.BBox(-112.8089, 33.7306, -88.5951, 46.6244)\n", | ||
" Map.addLayer(data, {}, 'ROI')\n", | ||
" Map.user_roi = None\n", | ||
"\n", | ||
"Map.centerObject(data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The input data can also be a file path or HTTP URL to a vector dataset. There are two ways to create a fishnet: specifying horizontal and vertical intervals or the number of rows and columns.\n", | ||
"\n", | ||
"Let's create a fishnet by specifying horizontal and vertical intervals in degrees." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fishnet = geemap.fishnet(data, h_interval=2.0, v_interval=2.0, delta=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Map.addLayer(fishnet, {}, 'Fishnet 1')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Draw another polygon on the map." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = Map.user_roi\n", | ||
"\n", | ||
"if data is None:\n", | ||
" data = ee.Geometry.Polygon(\n", | ||
" [\n", | ||
" [\n", | ||
" [-64.602356, -1.127399],\n", | ||
" [-68.821106, -12.625598],\n", | ||
" [-60.647278, -22.498601],\n", | ||
" [-47.815247, -21.111406],\n", | ||
" [-43.860168, -8.913564],\n", | ||
" [-54.582825, -0.775886],\n", | ||
" [-60.823059, 0.454555],\n", | ||
" [-64.602356, -1.127399],\n", | ||
" ]\n", | ||
" ]\n", | ||
" )\n", | ||
" Map.addLayer(data, {}, 'ROI2')\n", | ||
"\n", | ||
"Map.centerObject(data)\n", | ||
"Map" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Let's create another fishnet by specifying the number of rows and columns." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fishnet = geemap.fishnet(data, rows=6, cols=8, delta=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Map.addLayer(fishnet, {}, 'Fishnet 2')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"anaconda-cloud": {}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<a href=\"https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/117_fishnet.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\"/></a>\n", | ||
"\n", | ||
"**Creating a fishnet based on an input vector dataset**\n", | ||
"\n", | ||
"Uncomment the following line to install [geemap](https://geemap.org) if needed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# !pip install -U geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ee\n", | ||
"import geemap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Map = geemap.Map()\n", | ||
"Map" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Simply draw a rectangle or polyon on the map use to used as an ROI. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = Map.user_roi\n", | ||
"\n", | ||
"if data is None:\n", | ||
" data = ee.Geometry.BBox(-112.8089, 33.7306, -88.5951, 46.6244)\n", | ||
" Map.addLayer(data, {}, 'ROI')\n", | ||
" Map.user_roi = None\n", | ||
"\n", | ||
"Map.centerObject(data)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The input data can also be a file path or HTTP URL to a vector dataset. There are two ways to create a fishnet: specifying horizontal and vertical intervals or the number of rows and columns.\n", | ||
"\n", | ||
"Let's create a fishnet by specifying horizontal and vertical intervals in degrees." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fishnet = geemap.fishnet(data, h_interval=2.0, v_interval=2.0, delta=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Map.addLayer(fishnet, {}, 'Fishnet 1')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Draw another polygon on the map." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = Map.user_roi\n", | ||
"\n", | ||
"if data is None:\n", | ||
" data = ee.Geometry.Polygon(\n", | ||
" [\n", | ||
" [\n", | ||
" [-64.602356, -1.127399],\n", | ||
" [-68.821106, -12.625598],\n", | ||
" [-60.647278, -22.498601],\n", | ||
" [-47.815247, -21.111406],\n", | ||
" [-43.860168, -8.913564],\n", | ||
" [-54.582825, -0.775886],\n", | ||
" [-60.823059, 0.454555],\n", | ||
" [-64.602356, -1.127399],\n", | ||
" ]\n", | ||
" ]\n", | ||
" )\n", | ||
" Map.addLayer(data, {}, 'ROI2')\n", | ||
"\n", | ||
"Map.centerObject(data)\n", | ||
"Map" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Let's create another fishnet by specifying the number of rows and columns." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fishnet = geemap.fishnet(data, rows=6, cols=8, delta=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Map.addLayer(fishnet, {}, 'Fishnet 2')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"anaconda-cloud": {}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.