Mathieu,

Your code is somewhat opaque for using
proj4string(r) <- CRS("+init=EPSG:4326")
instead of the more transparent
proj4string(r) <- "+proj=longlat +datum=WGS84"

But to understand the error message you need to show 'world.r'; the warning
message suggests that it is outside the normal range for lon/lat data.

Robert



On Wed, Apr 3, 2013 at 1:07 AM, Mathieu Rajerison <
mathieu.rajerison@gmail.com> 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@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

