[R-sig-Geo] Defining CRS when loading a raster doesn't seems to work anymore

Michael Sumner mdsumner at gmail.com
Sun Nov 17 17:27:59 CET 2013


I don't think it ever was possible to do this. If you look carefully
at the Details for ?raster, it mentions extra arguments passed via ...
and none of these is "crs" for the "character" method. That can be a
bit obscure until you understand that the character method (for a
file) does not allow you to pass in crs at that point, it's only
defined for the signatures  "missing", "Extent", "matrix" and
"big.matrix".

Does that make sense?

On Fri, Nov 15, 2013 at 6:35 PM, Arnaud Mosnier <a.mosnier at gmail.com> wrote:
> Hi Jan,
>
> Thanks.
> You can also use
> proj4string(r) <- "+proj=longlat +ellps=WGS84"
>
> but the problem (the bug ?) is that it does not work anymore defining
> directly the crs into the raster function.
>
> Arnaud
>
>
> 2013/11/15 Verbesselt, Jan <jan.verbesselt at wur.nl>
>
>> Hi Arnaud,
>>
>> Something like:
>>
>> r <- raster()
>> projection(r)
>> projection(r) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84"
>> projection()
>>
>>
>> Might help,
>>
>> Best,
>> Jan
>>
>>
>> On 15/11/13 17:52, "Arnaud Mosnier" <a.mosnier at gmail.com> wrote:
>>
>> >Hi all,
>> >
>> >I re-run a script written some times ago containing a line like the
>> >following
>> >
>> >test <- raster("myraster.tif", crs = "+proj=longlat +ellps=WGS84")
>> >
>> >The file is loaded correctly, but the crs was not attributed.
>> >
>> >>proj4string(test)
>> >
>> >gives me
>> >
>> >[1] "NA"
>> >
>> >
>> >When looking at the help file, nothing seems to have changed, so what the
>> >problem ?
>> >Any suggestion ?
>> >
>> >Thanks
>> >
>> >Arnaud
>> >
>> >       [[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
>> >
>>
>>
>>
>
>         [[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



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-sig-Geo mailing list