[R-sig-Geo] raster::distance, "raster has a longitude/latitude CRS, but coordinates do not match that"

Pascal Oettli kridox at ymail.com
Wed Apr 3 10:34:09 CEST 2013


Hello,

When I run your script, I get warnings, not errors. And the raster file 
"dist" is created.

Regards,
Pascal


On 04/03/2013 05:07 PM, Mathieu Rajerison wrote:
> Hi,
>
> I've got a vector layer of the world that I took from Natural Earth.
>
> I tried to get a distance raster from the coastline. With a raster
> resolution of 10, no problem, I get the distance raster. But if I decrease
> the resolution to 5, I get the error:
>
> "1: In .couldBeLonLat(x) :
>    raster has a longitude/latitude CRS, but coordinates do not match that
> 2: In raster:::.couldBeLonLat(x) :
>    raster has a longitude/latitude CRS, but coordinates do not match that"
>
>
> Here is the code:
>
> library(rgdal)
> library(raster)
>
> world <- readOGR("F:/DATAS/NATURAL
> EARTH/ne_110m_admin_0_countries_lakes/ne_110m_admin_0_countries_lakes.shp",
> "ne_110m_admin_0_countries_lakes")
>
> r <- raster(extent(world)); res(r) <- 5; proj4string(r) <-
> CRS("+init=EPSG:4326")
> world.r <- rasterize(world, r)
> dist <- distance(world.r)
>
>
> Here is my session info:
>
>> sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
>   LC_MONETARY=French_France.1252
> [4] LC_NUMERIC=C                   LC_TIME=French_France.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_2.0-12 rgdal_0.7-18  sp_0.9-99
>
> loaded via a namespace (and not attached):
> [1] grid_2.15.1    lattice_0.20-6 tools_2.15.1
>
>
> Thanks for any help,
>
> Mathieu
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list