if(run_documentation()) {
#Create the water palette
water_palette = colorRampPalette(c("darkblue", "dodgerblue", "lightblue"))(200)
bathy_hs = height_shade(montereybay, texture = water_palette)
#Generate flat water heightmap
mbay = montereybay
mbay[mbay < 0] = 0
base_map = mbay |>
height_shade() |>
add_overlay(generate_altitude_overlay(bathy_hs, montereybay, 0, 0)) |>
add_shadow(lamb_shade(montereybay,zscale=50),0.3)
#Plot a compass
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay)) |>
plot_map()
}
if(run_documentation()) {
#Change the position to be over the water
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15)) |>
plot_map()
}
if(run_documentation()) {
#Change the type
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15,
compass_type = "split_arrow")) |>
plot_map()
}
if(run_documentation()) {
#Change the type
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15,
compass_type = "split_arrow_ring")) |>
plot_map()
}
if(run_documentation()) {
#Change the type
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15,
compass_type = "triangle_circle")) |>
plot_map()
}
if(run_documentation()) {
#Change the text color for visibility
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, compass_type = "split_arrow",
x = 0.15, text_color="white")) |>
plot_map()
}
if(run_documentation()) {
#Alternatively, add a halo color to improve contrast
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.15,
compass_type = "split_arrow", halo_color="white", halo_expand = 2)) |>
plot_map()
}
if(run_documentation()) {
#Change the color scheme
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.15,
compass_type = "split_arrow", halo_color="white",
halo_expand = 2, color1 = "purple", color2 = "red")) |>
plot_map()
}
if(run_documentation()) {
#Remove the inner border
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.15,
border_color=NA,compass_type = "split_arrow",
halo_color="white", halo_expand = 2,
color1 = "darkolivegreen4", color2 = "burlywood3")) |>
plot_map()
}
if(run_documentation()) {
#Change the size of the compass and text
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.75, y=0.75,
halo_color="white", halo_expand = 2,compass_type = "classic",
size=0.075*2, text_size = 1.25)) |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.45, y=0.45,
halo_color="white", halo_expand = 2,compass_type = "split_arrow_ring",
size=0.075)) |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.15,
halo_color="white", halo_expand = 2,compass_type = "split_arrow",
size=0.075/2, text_size = 0.75)) |>
plot_map()
}
if(run_documentation()) {
#Change the bearing of the compass
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.15,
halo_color="white", halo_expand = 2, bearing=30, compass_type = "classic",
size=0.075)) |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.35, y=0.15,
halo_color="white", halo_expand = 2, bearing=15, compass_type = "triangle_circle",
size=0.075)) |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.35,
halo_color="white", halo_expand = 2, bearing=-45, compass_type = "split_arrow_ring",
size=0.075)) |>
plot_map()
}
if(run_documentation()) {
#Create a drop shadow effect
base_map |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.15,
text_color="white", halo_alpha=0.7, halo_blur=3,
halo_color="black", halo_expand = 2, halo_offset = c(0.002,-0.002))) |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.35, y=0.15,
text_color="white", halo_alpha=0.7, halo_blur=3,
compass_type = "split_arrow",
halo_color="black", halo_expand = 2, halo_offset = c(0.002,-0.002))) |>
add_overlay(generate_compass_overlay(heightmap = montereybay, x = 0.15, y=0.35,
text_color="white", halo_alpha=0.2, halo_blur=8,
compass_type = "split_arrow_ring",
halo_color="white", halo_expand = 2)) |>
plot_map()
}
Run the code above in your browser using DataLab