| Title: | Derive a Color Palette from a Particular Location on Earth |
|---|---|
| Description: | Downloads a satellite image via ESRI and maptiles (these are originally from a variety of aerial photography sources), translates the image into a perceptually uniform color space, runs one of a few different clustering algorithms on the colors in the image searching for a user-supplied number of colors, and returns the resulting color palette. |
| Authors: | Will Cornwell [aut, cre] (ORCID: <https://orcid.org/0000-0003-4080-4073>), Mitch Lyons [aut], Nick Murray [aut] |
| Maintainer: | Will Cornwell <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.1 |
| Built: | 2026-05-25 06:51:31 UTC |
| Source: | https://github.com/traitecoevo/earthtones |
Download a satellite image from a selected provider, extract dominant colors, and generate an earth-tone palette.
get_earthtones( latitude = 50.759, longitude = -125.673, zoom = 11, number_of_colors = 3, method = "pam", sample_rate = 500, include_map = TRUE, provider = "Esri.WorldImagery", ... )get_earthtones( latitude = 50.759, longitude = -125.673, zoom = 11, number_of_colors = 3, method = "pam", sample_rate = 500, include_map = TRUE, provider = "Esri.WorldImagery", ... )
latitude |
Numeric. Latitude coordinate for the center of the satellite image. |
longitude |
Numeric. Longitude coordinate for the center of the satellite image. |
zoom |
Numeric. Zoom level between 0 (whole world) and 13 (high detail). Higher values zoom in closer. |
number_of_colors |
Numeric. Number of dominant colors to extract. |
method |
Character. Clustering method to identify dominant colors. Options are |
sample_rate |
Numeric. Subsampling factor; higher values reduce computation by sampling fewer pixels. |
include_map |
Logical. If |
provider |
Character. Tile provider for satellite imagery. Currently supports |
... |
Additional arguments passed to internal functions (currently unused). |
The function retrieves satellite imagery from the specified provider, extracts colors by converting the imagery into a perceptually uniform color space, and applies a clustering algorithm to determine dominant colors. Zoom level and location significantly influence the palette generated.
An object of class "palette" if include_map = TRUE, containing:
pal: A vector of hexadecimal color codes representing the dominant colors.
map: A raster image object of the satellite imagery.
If include_map = FALSE, returns a vector of hexadecimal color codes.
## Not run: # Get a palette for a location in the Bahamas get_earthtones(latitude = 24.2, longitude = -77.88, zoom = 11, number_of_colors = 5) # Return palette only, without map get_earthtones(latitude = 24.2, longitude = -77.88, zoom = 11, number_of_colors = 5, include_map = FALSE) ## End(Not run)## Not run: # Get a palette for a location in the Bahamas get_earthtones(latitude = 24.2, longitude = -77.88, zoom = 11, number_of_colors = 5) # Return palette only, without map get_earthtones(latitude = 24.2, longitude = -77.88, zoom = 11, number_of_colors = 5, include_map = FALSE) ## End(Not run)
Visualizes the palette and associated satellite image.
## S3 method for class 'palette' print(x, ...)## S3 method for class 'palette' print(x, ...)
x |
An object of class |
... |
Additional arguments passed to plotting methods. |
No return value; called for its side effect of plotting.