Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ee.Image.fastDistanceTransform
Stay organized with collections
Save and categorize content based on your preferences.
Returns the distance, as determined by the specified distance metric, to the nearest non-zero valued pixel in the input. The output contains values for all pixels within the given neighborhood size, regardless of the input's mask. Note: the default distance metric returns squared distance.
Usage | Returns | Image.fastDistanceTransform(neighborhood, units, metric) | Image |
Argument | Type | Details | this: image | Image | The input image. |
neighborhood | Integer, default: 256 | Neighborhood size in pixels. |
units | String, default: "pixels" | The units of the neighborhood, currently only 'pixels' are supported. |
metric | String, default: "squared_euclidean" | Distance metric to use: options are `squared_euclidean`, `manhattan` or `chebyshev`. |
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 2024-07-13 UTC.
[null,null,["Last updated 2024-07-13 UTC."],[[["\u003cp\u003eCalculates the distance to the closest non-zero pixel for every pixel in an image, considering a specified neighborhood and distance metric.\u003c/p\u003e\n"],["\u003cp\u003eProvides flexibility in choosing neighborhood size, measurement units (currently only pixels), and distance metric (squared Euclidean, Manhattan, or Chebyshev).\u003c/p\u003e\n"],["\u003cp\u003eOutputs an image where each pixel value represents the calculated distance to its nearest non-zero pixel, including areas outside the input mask.\u003c/p\u003e\n"],["\u003cp\u003eDefaults to a neighborhood size of 256 pixels, uses pixels as the unit of measurement, and employs the squared Euclidean distance metric.\u003c/p\u003e\n"]]],[],null,["# ee.Image.fastDistanceTransform\n\nReturns the distance, as determined by the specified distance metric, to the nearest non-zero valued pixel in the input. The output contains values for all pixels within the given neighborhood size, regardless of the input's mask. Note: the default distance metric returns squared distance.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------------------------------------------|---------|\n| Image.fastDistanceTransform`(`*neighborhood* `, `*units* `, `*metric*`)` | Image |\n\n| Argument | Type | Details |\n|----------------|--------------------------------------|--------------------------------------------------------------------------------------------|\n| this: `image` | Image | The input image. |\n| `neighborhood` | Integer, default: 256 | Neighborhood size in pixels. |\n| `units` | String, default: \"pixels\" | The units of the neighborhood, currently only 'pixels' are supported. |\n| `metric` | String, default: \"squared_euclidean\" | Distance metric to use: options are \\`squared_euclidean\\`, \\`manhattan\\` or \\`chebyshev\\`. |"]]