[R-sig-Geo] Shape file of USA land cover data

Hodgess, Erin HodgessE at uhd.edu
Thu Dec 6 09:00:20 CET 2012


Hi again Milan:

You could try this:

r1 <- as(r,"SpatialPolygonsDataFrame")
write(r1,"r1","r1",driver="ESRI Shapefile")

The first step will take a REALLY long time.

Erin

________________________________________
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Rainer Hurling [rhurlin at gwdg.de]
Sent: Thursday, December 06, 2012 12:30 AM
To: Milan Sharma
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] Shape file of USA land cover data

Am 06.12.2012 06:23 (UTC+1) schrieb Milan Sharma:
> My rgdal version is 2.0-31 (see below) and how the system says my version is 0.7-19? Isn't it interesting?

It seems you mixed up 'rgdal' with 'raster' here. These are different
packages and rgdal is needed by raster (as a dependency).

Please update rgdal.

>> library(raster)
> raster 2.0-31 (9-November-2012)
>> setwd("C://Users//rasmit99//Desktop")
>> r <- raster("C://Users//rasmit99//Desktop//NLCD2006_landcover_4-20-11_se5.img")
> Error in .requireRgdal(FALSE) : you use rgdal version: 0.7-19
> You need version 0.7-22 or higher
>>
> Please clarify me if you see whats going on.
> Milan
>
>
>
> ________________________________
>  From: Michael Sumner <mdsumner at gmail.com>
>
> Sent: Wednesday, December 5, 2012 11:13 PM
> Subject: Re: [R-sig-Geo] Shape file of USA land cover data
>
>
> sessionInfo() will tell you what's loaded and install.packages("rgdal") in a fresh session will install latest, depending on your system
>
> On Thursday, December 6, 2012, Milan Sharma  wrote:
>
> Mike, I just updated my R (I uninstalled the previous version of R and installed R version 2.15.2). Still, I get the same error message.
>> BY the way, how do I check what version of rgdal version do I have and how to update that to higher one?
>> Milan
>>
>>
>>
>> Subject: Re: [R-sig-Geo] Shape file of USA land cover data
>>
>> The error message already advises on what is required:  "you use rgdal
>> version: 0.7-19. You need version 0.7-22 or higher".
>>
>> Is that not clear somehow? It's important to read the messages and
>> work on understanding them.
>>
>> Please upgrade to latest rgdal and raster, it only creates extra work
>> trying to chase issues with outdated versions. If you have trouble
>> upgrading then that's another topic, for another list.  The "R
>> Installation and Administration" manual is the first port of call for
>> maintaining your R installation, but how to do it exactly will depend
>> on your set up, operating system, whether your R is current, and other
>> things that we do not know.
>>
>> Cheers, Mike.
>>
>>
>
> rote:
>>> Hi Erin,
>>> I got the following error..
>  Can you advise me of the solution?
>>>> setwd("C://Users//milan//Desktop")
>>>> r <- raster("nlcd2006_landcover_4-20-11_se5.img")
>>> Error in .requireRgdal(FALSE) : you use rgdal version: 0.7-19
>>> You need version 0.7-22 or higher
>>> ________________________________
>>> From: "Hodgess, Erin" <HodgessE at uhd.edu>
>>> To: Michael Sumner <mdsumner at gmail.com>; Milan Sharma
>
>>> Cc: "r-sig-geo at r-project.org" <r-sig-geo at r-project.org>
>>> Sent:
>  Wednesday, December 5, 2012 9:45 PM
>>> Subject: RE: [R-sig-Geo] Shape file of USA land cover data
>>>
>>> Hi
>>>
>>> I got the same data set that Milan did and used the raster:
>>>
>>> r <- raster("c://goodc//nlcd2006_landcover_4-20-11_se5.img")
>>>
>>> and it worked.  When I used gdal, it said that it was too big.
>>>
>>> Thanks,
>>> Erin
>>> PS the plot looks really nice too.
>>>
>>> ________________________________________
>>> From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on
>>> behalf of Michael Sumner [mdsumner at gmail.com]
>>> Sent: Wednesday, December 05, 2012 8:34
>  PM
>>> To: Milan Sharma
>>> Cc: r-sig-geo at r-project.org
>>> Subject: Re: [R-sig-Geo] Shape file of USA land cover data
>>>
>>> It's not a shapefile, and it's not a vector format. It's a gridded
>>> (raster) format. Specifically it's an Erdas Imaging (.img) format:
>>>
>>> http://www.gdal.org/frmt_hfa.html
>>>
>>> I tried the Hawaii one which is much smaller (2.4Mb) and so more
>>> reasonable to share.
>>>
>>> http://gisdata.usgs.gov/TDDS/DownloadFile.php?TYPE=nlcdhi&FNAME=HI_landcover_wimperv_9-30-08_se5.zip
>>>
>>> You seem to have found metadata files, but I haven't found what you
>>> presented to us.
>>>
>>> I get this:
>>>
>>> list.files()
>>>
>  [1] "hi_landcover_wimperv_9-30-08_se5.img"
>>> [2] "hi_landcover_wimperv_9-30-08_se5.rrd"
>>> [3] "landcov_meta_web_final"
>>>
>>> library(raster)
>>> r <- raster("hi_landcover_wimperv_9-30-08_se5.img")
>>> r
>>> class      : RasterLayer
>>> dimensions  : 12618, 19439, 245281302  (nrow, ncol, ncell)
>>> resolution  : 30, 30  (x, y)
>>> extent      : -345945, 237225, 1753875, 2132415  (xmin, xmax, ymin, ymax)
>>> coord. ref. : +proj=aea +lat_1=8.000000000000002 +lat_2=18 +lat_0=3
>>> +lon_0=-157 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m
>>> +no_defs
>>> data source :
>>> C:\Users\Michaels\Downloads\HI_landcover_wimperv_9-30-08_se5\hi_landcover_wimperv_9-30-08_se5.img
>>> names      : hi_landcover_wimperv_9.30.08_se5
>>> values      : 0, 95  (mi

_______________________________________________
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