Earth Engine is introducing
noncommercial quota tiers to safeguard shared compute resources and ensure reliable performance for everyone. All noncommercial projects will need to select a quota tier by
April 27, 2026 or will use the Community Tier by default. Tier quotas will take effect for all projects (regardless of tier selection date) on
April 27, 2026.
Learn more.
ee.Image.directionalDistanceTransform
Stay organized with collections
Save and categorize content based on your preferences.
For each zero-valued pixel in the source, get the distance to the nearest non-zero pixels in the given direction.
Returns a band of floating point distances called "distance".
| Usage | Returns | Image.directionalDistanceTransform(angle, maxDistance, labelBand) | Image |
| Argument | Type | Details | this: source | Image | The source image. |
angle | Float | The angle, in degrees, at which to search for non-zero pixels. |
maxDistance | Integer | The maximum distance, in pixels, over which to search. |
labelBand | String, default: null | If provided, multi-band inputs are permitted and only this band is used for searching. All other bands are returned and populated with the per-band values found at the searched non-zero pixels in the label band. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],["The `directionalDistanceTransform` function calculates the distance from each zero-valued pixel in a source image to the nearest non-zero pixel along a specified angle. It returns an image containing these floating-point distances. The search is performed up to a maximum distance. Optionally, a specific band can be defined as the target for the search, while preserving the other bands with the values found at searched pixel locations.\n"]]