Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
giswqs
GitHub Repository: giswqs/geemap
Path: blob/master/docs/notebooks/117_fishnet.ipynb
2313 views
Kernel: Python 3

Open in Colab

Creating a fishnet based on an input vector dataset

Uncomment the following line to install geemap if needed.

# !pip install -U geemap
import ee import geemap
Map = geemap.Map() Map

Simply draw a rectangle or polyon on the map use to used as an ROI.

data = Map.user_roi if data is None: data = ee.Geometry.BBox(-112.8089, 33.7306, -88.5951, 46.6244) Map.addLayer(data, {}, "ROI") Map.user_roi = None Map.centerObject(data)

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.

Let's create a fishnet by specifying horizontal and vertical intervals in degrees.

fishnet = geemap.fishnet(data, h_interval=2.0, v_interval=2.0, delta=1)
Map.addLayer(fishnet, {}, "Fishnet 1")

Draw another polygon on the map.

data = Map.user_roi if data is None: data = ee.Geometry.Polygon( [ [ [-64.602356, -1.127399], [-68.821106, -12.625598], [-60.647278, -22.498601], [-47.815247, -21.111406], [-43.860168, -8.913564], [-54.582825, -0.775886], [-60.823059, 0.454555], [-64.602356, -1.127399], ] ] ) Map.addLayer(data, {}, "ROI2") Map.centerObject(data) Map

Let's create another fishnet by specifying the number of rows and columns.

fishnet = geemap.fishnet(data, rows=6, cols=8, delta=1)
Map.addLayer(fishnet, {}, "Fishnet 2")