Make a grid out of Image pixels


In [1]:
import ee
ee.Initialize()

In [2]:
from geetools import tools

In [3]:
from ipygee import *

Geometry


In [4]:
p = ee.Geometry.Point([-71.33972167968751, -42.737619925503054])
aoi = p.buffer(8000).bounds()

Image


In [5]:
i = ee.Image('COPERNICUS/S2/20181122T142749_20181122T143353_T18GYT').clip(aoi)

Make Grid


In [6]:
grid = tools.image.toGrid(i, 3, geometry=aoi)

Show on Map


In [7]:
Map = Map()

In [8]:
Map.show()



In [9]:
Map.addLayer(i, {'bands':['B2'], 'min':0, 'max':3000}, 'Image')

In [10]:
Map.addLayer(grid, None, 'Grid')

In [11]:
eprint(ee.Feature(grid.first()).geometry().projection())



In [12]:
eprint(i.select(0).projection())



In [13]:
Map.addLayer(ee.Feature(grid.first()).geometry().transform(i.select(0).projection(), 1), None, 'reprojected')

In [14]:
Map.addLayer(ee.Feature(grid.first()), None, 'first')

In [15]:
eprint(Map.getObject('reprojected'))