I have an extent object that I would like to re-project to lat and lon.

    class       : Extent
    xmin        : -5559753
    xmax        : -4447753
    ymin        : -4447852
    ymax        : -3335852
  • Use projectExtent after using your extent to create a raster with a crs. It does all the right things. (It is a pain that extent dies not have crs btw)
    – mdsumner
    May 31, 2016 at 22:23

2 Answers 2


You could just coerce the extent into a SpatialPolygons object and then use "spTransfrom".


( e <- raster::extent(-5559753, -4447753, -4447852, -3335852) )
e <- as(e, "SpatialPolygons")
  sp::proj4string(e) <- "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 
                     +b=6371007.181 +units=m +no_defs"

e.geo <- sp::spTransform(e, CRS("+proj=longlat +datum=WGS84 +no_defs 
                             +ellps=WGS84 +towgs84=0,0,0"))

Plot resulting extents

    title("Original extent")
    title("Geographic extent")

Looks like this can be done using the raster package. There is a projectExtent function that returns a warped raster object. Then just need to extract extent().

extent(projectExtent(raster_object,"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))

Thanks to mdsumner's comment!

  • It looks like you are only computing the extent of the reprojected corners. If a coordinate transform is a bit bendy (technical term) then its not always true that the new extent is the bounding box of the projected corners. It might not even be on the edges of the original extent for some projections onto the limb of the earth... But it depends on if you want the extent of the bounding box defined by the extent or just the projected extent coordinates...
    – Spacedman
    May 31, 2016 at 17:28
  • One quick way to help reduce the problem that @Spacedman is referring to, is to also project the other corners (upper left, lower right), then find the minimum/maximum values based on the four corners.
    – mkennedy
    May 31, 2016 at 18:51
  • 1
    projectExtent does all this, just need a raster object to carry the crs
    – mdsumner
    May 31, 2016 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.