-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Error when trying to plot a Coordinate System from another Celestial Body. #159
Comments
The issue is not on tidyterra and probably not even in terra, seems to be a feature of GDAL. However you can circumvent that using library(tidyterra)
#>
#> Adjuntando el paquete: 'tidyterra'
#> The following object is masked from 'package:stats':
#>
#> filter
library(terra)
#> terra 1.8.5
library(ggplot2)
# Mock your tile
rgb_tile <- rast(system.file("extdata/cyl_tile.tif", package = "tidyterra"))
crs(rgb_tile) <- crs("ESRI:103884")
rgb_tile
#> class : SpatRaster
#> dimensions : 212, 261, 3 (nrow, ncol, nlyr)
#> resolution : 2445.985, 2445.985 (x, y)
#> extent : -812067, -173664.9, 4852834, 5371383 (xmin, xmax, ymin, ymax)
#> coord. ref. : Mars_2000_South_Pole_Stereographic_sphere (ESRI:103884)
#> source : cyl_tile.tif
#> colors RGB : 1, 2, 3
#> names : cyl_tile_1, cyl_tile_2, cyl_tile_3
# Plot
ggplot() +
geom_spatraster_rgb(data = rgb_tile)
#> Warning in CPL_transform(x, crs, aoi, pipeline, reverse, desired_accuracy, :
#> GDAL Error 1: PROJ: proj_create_operations: Source and target ellipsoid do not
#> belong to the same celestial body (Mars vs Earth). You may override this check
#> by setting the PROJ_IGNORE_CELESTIAL_BODY environment variable to YES.
#> Warning in CPL_transform(x, crs, aoi, pipeline, reverse, desired_accuracy, :
#> GDAL Error 6: Cannot find coordinate operations from `ESRI:103884' to
#> `EPSG:4326'
#> Error: OGRCreateCoordinateTransformation(): transformation not available
# Set ENV Variable to yes
Sys.setenv(PROJ_IGNORE_CELESTIAL_BODY="YES")
ggplot() +
geom_spatraster_rgb(data = rgb_tile) Created on 2024-12-31 with reprex v2.1.1 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.2 (2024-10-31 ucrt)
#> os Windows 11 x64 (build 26100)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate Spanish_Spain.utf8
#> ctype Spanish_Spain.utf8
#> tz Europe/Madrid
#> date 2024-12-31
#> pandoc 3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> class 7.3-22 2023-05-03 [2] CRAN (R 4.4.2)
#> classInt 0.4-10 2023-09-05 [1] CRAN (R 4.4.0)
#> cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.1)
#> codetools 0.2-20 2024-03-31 [2] CRAN (R 4.4.2)
#> colorspace 2.1-1 2024-07-26 [1] CRAN (R 4.4.1)
#> curl 6.0.2 2024-12-16 [1] Github (jeroen/curl@0ae1b44)
#> DBI 1.2.3 2024-06-02 [1] CRAN (R 4.4.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.4.0)
#> e1071 1.7-16 2024-09-16 [1] CRAN (R 4.4.2)
#> evaluate 1.0.1 2024-10-10 [1] CRAN (R 4.4.2)
#> farver 2.1.2 2024-05-13 [1] CRAN (R 4.4.0)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
#> fs 1.6.5 2024-10-30 [1] CRAN (R 4.4.2)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.0)
#> ggplot2 * 3.5.1 2024-04-23 [1] CRAN (R 4.4.0)
#> glue 1.8.0 2024-09-30 [1] CRAN (R 4.4.2)
#> gtable 0.3.6 2024-10-25 [1] CRAN (R 4.4.2)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
#> KernSmooth 2.23-24 2024-05-17 [1] CRAN (R 4.4.0)
#> knitr 1.49 2024-11-08 [1] CRAN (R 4.4.2)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0)
#> munsell 0.5.1 2024-04-01 [1] CRAN (R 4.4.0)
#> pillar 1.10.0 2024-12-17 [1] CRAN (R 4.4.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0)
#> proxy 0.4-27 2022-06-09 [1] CRAN (R 4.4.0)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0)
#> Rcpp 1.0.13-1 2024-11-02 [1] CRAN (R 4.4.2)
#> reprex 2.1.1 2024-07-06 [1] CRAN (R 4.4.1)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0)
#> rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.4.2)
#> rstudioapi 0.17.1 2024-10-22 [1] CRAN (R 4.4.2)
#> scales 1.3.0 2023-11-28 [1] CRAN (R 4.4.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0)
#> sf 1.0-19 2024-11-05 [1] CRAN (R 4.4.2)
#> terra * 1.8-5 2024-12-12 [1] CRAN (R 4.4.2)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0)
#> tidyr 1.3.1 2024-01-24 [1] CRAN (R 4.4.0)
#> tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.4.0)
#> tidyterra * 0.6.1 2024-06-08 [1] CRAN (R 4.4.0)
#> units 0.8-5 2023-11-28 [1] CRAN (R 4.4.0)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0)
#> withr 3.0.2 2024-10-28 [1] CRAN (R 4.4.2)
#> xfun 0.49 2024-10-31 [1] CRAN (R 4.4.2)
#> xml2 1.3.6 2023-12-04 [1] CRAN (R 4.4.0)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.1)
#>
#> [1] C:/Users/diego/AppData/Local/R/win-library/4.4
#> [2] C:/Program Files/R/R-4.4.2/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error when trying to plot a Coordinate System from another Celestial Body.
When trying to create a ggplot from a Mars Dataset
I do not know whether this is a thing you want to even cover as its abit of a different application. But the Planetary Community would be very gratefull if this could work.
The text was updated successfully, but these errors were encountered: