Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CopernicusDEM vignette not producing maps as expected: lft map is produced without points and tmaps are different than in vignette #1

Closed
APDrager opened this issue Dec 7, 2024 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@APDrager
Copy link

APDrager commented Dec 7, 2024

When running the exact vignette script: https://cran.r-project.org/web/packages/CopernicusDEM/vignettes/Copernicus_Digital_Elevation_Models.html, using Windows 11 home and R version 4.4.1, and using the newest version of tmap (version 3.99.9003), I encountered the issue that the leaflet map was not produced with points, and the tmaps were produced differently than the examples in the vignette. The lft command yielded the CopernicusDEM aoi map but without the points. The tmps were not colored by 'individual local identifier'.

Here is the readout when running the script:

Processing of the 'Alberta_Wolves.csv' file ...
Convert the data.table to an 'sf' object ...
Transform the projection of the 'sf' object from 4326 to 7801 ...
Create a buffer of 250 meters using as input the initial sf object ...
Back-tranformation of the projection and computation of the bounding box ...
Use the bounding box to extract the raster extent ...
Compute the centroid of the sf-buffer object ...
Elapsed time: 0 hours and 0 minutes and 0 seconds.
Parallel download of the 6 .tif files using 4 threads starts ...
Elapsed time: 0 hours and 1 minutes and 29 seconds.
The VRT Mosaic will be built from 6 '.tif' files and will be saved in 'C:\Users\APD\AppData\Local\Temp\RtmpABfRIS/VRT_mosaic_FILE.vrt' ...
0...10...20...30...40...50...60...70...80...90...100 - done.
Elapsed time: 0 hours and 0 minutes and 0 seconds.
The raster will be uploaded ...
The 'sf' object will be converted to a spatial vector ...
The raster will be cropped ...
ℹ tmap mode set to "view".
Processing of the 'Mountain_caribou.csv' file ...
Convert the data.table to an 'sf' object ...
Transform the projection of the 'sf' object from 4326 to 7801 ...
Create a buffer of 250 meters using as input the initial sf object ...
Back-tranformation of the projection and computation of the bounding box ...
Use the bounding box to extract the raster extent ...
Compute the centroid of the sf-buffer object ...
Elapsed time: 0 hours and 0 minutes and 0 seconds.
Parallel download of the 16 .tif files using 4 threads starts ...
Elapsed time: 0 hours and 2 minutes and 23 seconds.
The VRT Mosaic will be built from 22 '.tif' files and will be saved in 'C:\Users\APD\AppData\Local\Temp\RtmpABfRIS/VRT_mosaic_FILE.vrt' ...
0...10...20...30...40...50...60...70...80...90...100 - done.
Elapsed time: 0 hours and 0 minutes and 0 seconds.
The raster will be uploaded ...
The 'sf' object will be converted to a spatial vector ...
The raster will be cropped ...
ℹ tmap mode set to "view".

dtbl_all = rbind(leafgl_data$Canis lupus, leafgl_data$Rangifer tarandus)

see the number of observations for each animal

table(dtbl_all$individual-taxon-canonical-name)

  Canis lupus Rangifer tarandus 
        15159              3992 

create an 'sf' object of both data.tables

dat_gps_tcx = sf::st_as_sf(dtbl_all, coords = c("longitude", "latitude"), crs = 4326)
lft = leaflet::leaflet()
lft = leaflet::addProviderTiles(map = lft, provider = leaflet::providers$OpenTopoMap)
lft = leafgl::addGlPoints(map = lft,

  •                       data = dat_gps_tcx,
    
  •                       opacity = 1.0,
    
  •                       fillColor = 'individual-taxon-canonical-name',
    
  •                       popup = 'individual-taxon-canonical-name')
    

Registered S3 method overwritten by 'jsonify':
method from
print.json jsonlite

lft
tmap_data$Rangifer tarandus # caribou
SpatRaster object downsampled to 4206 by 2379 cells.
Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is FALSE
Warning message:
Number of levels of the variable assigned to the aesthetic "col" of the layer "dotssymbols" is 138, which is larger than n.max (which is 30), so levels are combined.

Thank you!

@github-actions github-actions bot added the help wanted Extra attention is needed label Dec 7, 2024
@mlampros
Copy link
Owner

mlampros commented Dec 9, 2024

hi @APDrager,

I just updated the code on Github and submitted the new version to CRAN (1.0.5). As mentioned in the NEWS.md file I replaced tmap, leaflet, leafgl with the mapview R package.
You can install first the latest version of mapview using

remotes::install_github("r-spatial/mapview")

and then the updated version of CopernicusDEM

remotes::install_github('mlampros/CopernicusDEM')

@mlampros
Copy link
Owner

I'll close the issue as the updated version was uploaded to CRAN as well

Feel free to reopen if the code does not work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants