Skip to main content
added 338 characters in body
Source Link
Robert Hijmans
  • 11.1k
  • 27
  • 37

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection). Can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. But you can do that with lon/lat raster data as well, see, e.g., raster::area. That could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

Here is an approach to sum area by classes

library(terra)
set.seed(10)
r <- raster(ncol=20, nrow=10, vals=sample(4, 200, replace=TRUE))
a <- area(r) / 1000000
zonal(a, r, sum)
#     zone     value
#[1,]    1 129.01240
#[2,]    2 145.11511
#[3,]    3 136.19166
#[4,]    4  99.59283

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection). Can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. But you can do that with lon/lat raster data as well, see, e.g., raster::area. That could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection). Can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. But you can do that with lon/lat raster data as well, see, e.g., raster::area. That could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

Here is an approach to sum area by classes

library(terra)
set.seed(10)
r <- raster(ncol=20, nrow=10, vals=sample(4, 200, replace=TRUE))
a <- area(r) / 1000000
zonal(a, r, sum)
#     zone     value
#[1,]    1 129.01240
#[2,]    2 145.11511
#[3,]    3 136.19166
#[4,]    4  99.59283
deleted 3 characters in body
Source Link
Robert Hijmans
  • 11.1k
  • 27
  • 37

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection), can. Can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. E.g., see raster::area. But you can do that with lon/lat raster data as well, and thatsee, e.g., raster::area. That could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection), can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. E.g., see raster::area. But you can do that with lon/lat raster data as well, and that could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection). Can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. But you can do that with lon/lat raster data as well, see, e.g., raster::area. That could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

added 7 characters in body
Source Link
Robert Hijmans
  • 11.1k
  • 27
  • 37

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you would need to align raster data with some other raster data. That isdoes not seem to be the case here (as you would not have to choose the projection), can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. E.g., see raster::area. But you can do that with lon/lat raster data as well, and that could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you would need to align raster data with some other raster data. That is not the case here (as you would not have to choose the projection), can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. E.g., see raster::area. But you can do that with lon/lat raster data as well, and that could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

In your description you do not provide a reason why you want to change the projection. The only valid reason in data analysis would be that you need to align raster data with some other raster data. That does not seem to be the case here (as you would not have to choose the projection), can you explain why you want to project?

You do mention that you want to have meters, suggesting that the reason could be that you want to measure area. E.g., see raster::area. But you can do that with lon/lat raster data as well, and that could be the preferable approach if you are concerned, as you are, about data loss.

It would be helpful if you included a minimal, self-contained, reproducible example in your question (that is, create an example raster with code and show / state what you ultimately want to do with it).

Source Link
Robert Hijmans
  • 11.1k
  • 27
  • 37
Loading