[R] creat raster from XYZ

Michael Sumner mdsumner at gmail.com
Thu Jun 27 22:22:42 CEST 2013


On Fri, Jun 28, 2013 at 1:41 AM, Shane Carey <careyshan at gmail.com> wrote:
> Hi Michael,
>
> I tried this but it would not work. I get an error stating that  x cell
> sizes are not regular.
> Any ideas?
>

The function is reporting that your data don't fall on a grid, you'll
need to figure out why that is the case, or if it is not the case why
you think it should be (plotting the points is a good start).
rasterFromXYZ has some arguments for controlling the tolerance of
numeric error for the grid interpretation (tables or coordinates
stored in text are a bad way to store such data, since you can
introduce innacuracies in the coordinate values and the vast majority
of them are redudant if it's really a grid).

The function's help also points you to rasterize() which is for
converting irregular data to a grid, but this is a very broad and
complicated modelling topic, depending on your domain. I would trace
the origins of your file back to where it's supposed to be a real grid
and demand a decent raster format that is efficient and unambiguous
before exploring that.

R-Sig-Geo is a mailing list more suited to this topic, and is where
the geo-geeks hang out. You should review the guidelines for that
mailing list (and this one).

Cheers, Mike.

>
>
>
> On Thu, Jun 27, 2013 at 12:40 PM, Michael Sumner <mdsumner at gmail.com> wrote:
>>
>> On Wed, Jun 26, 2013 at 12:53 AM, Shane Carey <careyshan at gmail.com> wrote:
>> > Hi,
>> >
>> > I have a data set consisting of XYZ data. the dimensions are 22427 rows
>> > by
>> > 3 columns.
>> >
>> > I try to use rasterFromXYZ from the raster package but I get the
>> > following
>> > error:
>> >
>> >  Error in rasterFromXYZ(DATA) : x cell sizes are not regular
>> >
>> > Any help would be appreciated.
>>
>> No problem.
>>
>> library(raster)
>> ?rasterFromXYZ
>>
>>
>> >
>> > Thanks
>> >
>> > --
>> > Shane
>> >
>> >         [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>> --
>> Michael Sumner
>> Hobart, Australia
>> e-mail: mdsumner at gmail.com
>
>
>
>
> --
> Shane



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



More information about the R-help mailing list