[R-sig-Geo] raster() not reading in discrete values

Robert J. Hijmans r.hijmans at gmail.com
Thu Nov 11 02:12:46 CET 2010


Well, GDALinfo in the latest 'rgdal' does in fact return the
attributes table, upon request, and 'raster' does request it (Roger
implemented this last week). You can see it (if it exists) when you do
print(x) with a RasterLayer (and when using the latest rgdal and
raster). But I have not (consciously) done anything with this that
might change how values are returned. So I think (hope) it has nothing
to do with this. What are your versions  ( sessionInfo() ) ? I may
need to see the arc grid file or a small subset of it. Can you read
the values correctly with rgdal ?
Robert

On Wed, Nov 10, 2010 at 4:54 PM, Michael Sumner <mdsumner at gmail.com> wrote:
> What are the kinds of values that you  see in ArcGIS?  Is this an ADF
> raster, i.e. a folder of many files like "w000001.adf" etc. ?
>
> This is a just a guess, so sorry if it's off-base - I don't know of
> any non-ESRI tool to get at these values.
> If this is an ADF raster I know that you won't be able to access the
> descriptive/categorical values you would use in Arc, you'll just get
> the underlying integer index.  (BTW, this lookup type with an
> underlying integer mapped to a 'descriptive value' is like the factor
> type in R - does that sound like what you have?).
>
> The raster is read via the GDAL library, which does not provide the
> "categorical values" you assign in Arc. It's just a part of the format
> that hasn't been reverse engineered by the GDAL developers, but
> further, if your descriptive values are actually text then GDAL cannot
> represent them - only numeric types are supported, even though the
> rasters in R can have text/character types.
>
> Cheers, Mike.
>
> On Thu, Nov 11, 2010 at 11:35 AM, Tyler Dean Rudolph
> <tylerdeanrudolph at gmail.com> wrote:
>> I have a pretty simple code to extract cell values from a habitat map
>> (RasterLayer) based on xy coordinates.  I recently updated habitat
>> information with a new raster image but for some reason now when I read in
>> the values it's as though they are no longer being interpreted as discrete
>> values, so instead of select, discrete classes I am getting new arbitrary
>> groupings that I didn't create.  The input file is a standard
>> ArcGIS-configured GRID raster layer.  The attribute table in ArcCatalogue
>> displays the data as expected, and I've ensured the raster has been classed
>> as containing discrete values prior to opening it in R.
>>
>> Perhaps something in the packages have changed since I ran this last?  I'm
>> currently trying to assess in the raster documentation what kind of
>> additional arguments I might have at my disposal in order to clarify how I
>> want the data to be read....
>>
>> Tyler
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
>
> --
> Michael Sumner
> Institute for Marine and Antarctic Studies, University of Tasmania
> Hobart, Australia
> e-mail: mdsumner at gmail.com
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list