Stay organized with collections
Save and categorize content based on your preferences.
Vector to raster conversion in Earth Engine is handled by the
featureCollection.reduceToImage() method. This method assigns pixels under
each feature the value of the specified property. This example uses the counties data
to create an image representing the land area of each county:
Specify a reducer to indicate how to aggregate properties of
overlapping features. In the previous example, since there is no overlap, an
ee.Reducer.first() is sufficient. As in this
example, pre-filter the data to eliminate nulls that can not be turned into an image.
The output should look something like Figure 1, which maps a color gradient to
county size. Like all image-outputting reducers in Earth Engine, the
scale is dynamically set by the output. In this case, the scale corresponds to the
zoom level in the Code Editor.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-02 UTC."],[[["The `featureCollection.reduceToImage()` method in Earth Engine converts vector data (like county boundaries) into raster images by assigning pixel values based on a specified property (e.g., land area)."],["To avoid errors, it's crucial to pre-filter the data to remove any features with null values for the property being used to create the image."],["When dealing with overlapping features, you need to specify a reducer (like `ee.Reducer.first()`) to determine how their properties are aggregated within each pixel."],["The output image's scale is dynamic, adjusting to the current zoom level in the Code Editor, ensuring visual clarity at different scales."],["This technique allows you to visualize feature properties geographically, using a color gradient to represent variations in values, as demonstrated in the county land area example."]]],[]]