ee.ImageCollection.distance

Produces a DOUBLE image where each pixel is the distance in meters from the pixel center to the nearest Point, LineString, or polygonal boundary in the collection. Note distance is also measured within interiors of polygons. Pixels that are not within 'searchRadius' meters of a geometry will be masked out.

Distances are computed on a sphere, so there is a small error proportional to the latitude difference between each pixel and the nearest geometry.

UsageReturns
ImageCollection.distance(searchRadius, maxError)Image
ArgumentTypeDetails
this: featuresFeatureCollection

Feature collection from which to get features used to compute pixel distances.

searchRadiusFloat, default: 100000

Maximum distance in meters from each pixel to look for edges. Pixels will be masked unless there are edges within this distance.

maxErrorFloat, default: 100

Maximum reprojection error in meters, only used if the input polylines require reprojection. If '0' is provided, then this operation will fail if projection is required.

Examples

JavaScript

// Your example goes here!

Python

# Your example goes here!