In [1]:
    
import ee
ee.Initialize()
    
In [2]:
    
from geetools import algorithms, ui, cloud_mask, tools
    
In [3]:
    
from ipygee import *
    
Area of Interest
In [4]:
    
p = ee.Geometry.Point([-71.33972167968751, -42.737619925503054])
aoi = p.buffer(8000).bounds()
    
Masked image
In [5]:
    
i = ee.Image('COPERNICUS/S2/20181122T142749_20181122T143353_T18GYT')
masked = cloud_mask.sentinel2()(i)
masked = masked.clip(aoi)
    
Distance to mask
In [6]:
    
max_distance = 2000
    
In [7]:
    
distance = algorithms.distanceToMask(masked, radius=max_distance, geometry=aoi)
    
In [8]:
    
Map = Map()
Map.show()
    
    
 
 
    
 
 
In [9]:
    
Map.addLayer(masked, {'bands':['B8', 'B11', 'B4'], 'min':0, 'max':5000}, 'Masked image')
    
In [10]:
    
Map.centerObject(aoi)
    
In [11]:
    
Map.addLayer(distance, {'min':0, 'max':max_distance}, 'distance')