[R-sig-Geo] Creating a Grid out of a matrix of coordinates

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sat Aug 22 10:03:33 CEST 2009


This suggests that the data you want to convert to a grid are not laid
out on a regular grid at all.
--
Edzer

Mehdi Khan wrote:
> Hello Paul,
>
> I get the following error:
>  gridded(wald)= TRUE
> suggested tolerance minimum: 0.125000000000666
> Error in points2grid(points, tolerance, round, fuzz.tol) :
>   dimension 1 : coordinate intervals are not constant
>
> What do I do?  Thanks a lot!
>
> On Fri, Aug 21, 2009 at 12:34 PM, Paul Hiemstra <p.hiemstra at geo.uu.nl>wrote:
>
>   
>> Hi,
>>
>> If your object's points are regularly spaced and in a SpatialPoints object,
>> use:
>>
>> gridded(myobj) = TRUE
>>
>> Or you can from a data.frame with the coordinates and attributes to a grid
>> by:
>>
>> coordinates(myobj) = ~x+y
>> gridded(myobj) = TRUE
>>
>> or shorthand:
>>
>> gridded(myobj) = ~x+y
>>
>> cheers,
>> Paul
>>
>> Mehdi Khan schreef:
>>
>>     
>>> Hello, I have a matrix 1.5 million rows long..
>>>
>>> wald:
>>>
>>>  coordinates  V3
>>> 1  (-124.996, 42.0458) 150
>>> 2  (-124.987, 42.0458) 150
>>> 3  (-124.979, 42.0458) 150
>>> 4  (-124.971, 42.0458) 150
>>> 5  (-124.963, 42.0458) 150
>>> 6  (-124.954, 42.0458) 150
>>> 7  (-124.946, 42.0458) 150
>>> 8  (-124.938, 42.0458) 150
>>> 9  (-124.929, 42.0458) 150
>>> 10 (-124.921, 42.0458) 150
>>>
>>>
>>> I would like to coerce this into a grid object so that I can overlay
>>> points
>>> onto it.  How exactly could I accomplish that?  Thank you!!
>>>
>>> Mehdi Khan
>>>
>>>        [[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
>>>
>>>
>>>       
>>     
>
> 	[[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
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list