milos-agathon / 3d-river-basin-map

In this repo, you will learn how to create stunning 3D maps of river basins using rayshader in R
12 stars 2 forks source link

Missing package? #1

Closed miguelbar3000 closed 8 months ago

miguelbar3000 commented 8 months ago

I had to install the magick package for your code to run on a MacBook. Once installed, everything worked like a charm, although it did take a while for the image to be generated.

milos-agathon commented 8 months ago

That is strange. The code doesn't use magick package. Is it a dependency for a package?

Redcozmo commented 7 months ago

Hello. Thanks for your script ! Very nice map after a looooooong computing time.

I've had the same issue than @miguelbar3000 but on ubuntu 22.04.

Rstudio asked me the magick package after this command :

elevation_matrix |>
  rayshader::height_shade(
    texture = colorRampPalette(
      c(
        "grey90",
        "grey60"
      )
    )(256)
  ) |>
  rayshader::add_overlay(
    rayshader::generate_polygon_overlay(
      geometry = country_basin_pal,
      extent = elevation_raster,
      heightmap = elevation_matrix,
      linecolor = palette,
      palette = palette,
      data_column_fill = "HYBAS_ID"
    ), alphalayer = .6 
  ) |>
  rayshader::add_overlay(
    rayshader::generate_line_overlay(
      geometry = country_river_width,
      extent = elevation_raster,
      heightmap = elevation_matrix,
      color = country_river_width$palette,
      linewidth = country_river_width$width,
      data_column_width = "width"
    ),
    alphalayer = 1
  ) |>
  rayshader::plot_3d(
    elevation_matrix,
    zscale = 10,
    solid = F,
    shadow = F,
    windowsize = c(
      w / 5, h / 5
    ),
    zoom = .515,
    phi = 85,
    theta = 0
  )

I got this error :

# Error in rayimage::add_image_overlay(hillshade, overlay, alpha = alphalayer,  : 
#   `magick` package required for adding overlay

And for the magick package, it prerequesite to install on ubuntu libmagick++-dev

sudo apt install libmagick++-dev