[R-sig-Geo] How to do Zonal Statistics after Kriging in R given Shapefile of Polygon

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Sep 13 10:29:00 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the script, you set the wrong CRS to the long/lat points. Set the
right CRS, then spTransform to the new one. Check that they match
after reprojection by plotting with axes, eg.

plot(muni.sp,axes=T)
points(muni.sp, col = 'red')

Second, when you work in projected coordinates having large numbers,
using 1 as an initial value for a variogram range fit will not work;
choose sth else, e.g. 100000 or so.

On 09/13/2013 06:12 AM, James Matthew Miraflor wrote:
> Hi Jesse, Edzer, and R-SIG-GEO!
> 
> I was able to make Kriging work, following the suggestions of Jesse
> and Edzer. However, the results don't turn out to be right - the
> Kriging and IDW done on a grid is not the same (in fact, it seems
> to be a mirror image) of the block kriging using a separate map.
> The grid kriging is in fact closer to the small area estimates
> (which is the actual sample).
> 
> You may take a look at the images here: 
> https://www.dropbox.com/sh/q5sev7n2pi6tq8f/tiqiFMjJS5
> 
> The R Code is here: 
> https://www.dropbox.com/sh/q5sev7n2pi6tq8f/oM87f6axv5/kriging_pov.r
>
>  The R Data is here: 
> https://www.dropbox.com/sh/q5sev7n2pi6tq8f/8jC9qmlBZB/POVKRIGE.RData
>
>  Would you know why block Kriging and block IDW have such a weird
> results? Thank you for your time and patience.
> 
> James
> 
> 
> On Fri, Sep 13, 2013 at 12:26 AM, James Matthew Miraflor < 
> james.miraflor at gmail.com> wrote:
> 
>> Thanks Jesse and Edzer! It finally worked.
>> 
>> 
>> On Thu, Sep 12, 2013 at 11:44 PM, Jesse Berman
>> <berman.jesse at gmail.com>wrote:
>> 
>>> robin<-"+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84
>>> +datum=WGS84 +units=m +no_defs" muni.sp2<-spTransform(muni.sp,
>>> CRS(robin)) brgy_poly2<-spTransform(brgy_poly, CRS(robin))
>>> 
>> 
>> 
>> 
>> 
>> -- *
>> 
>> * *James Matthew B. Miraflor* MS Computer Science College of
>> Engineering University of the Philippines
>> 
>> http://politicsforbreakfast.blogspot.com ________
>> 
>> "No problem can withstand the assault of sustained thinking." -
>> Voltaire ________
>> 
> 
> 
> 

- -- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSMszMAAoJEM1OCHCtOnfxFfEIAIOSncLp+X8cPfhxD3+uZm1g
QU+FL2EKrDippniw0i8fGv9+QYIpUf0qxQzMXsDtQj3nqitGSU8J2Hqqlytgj6z2
0gwdlP2Wrv2PWzotH7BJEZVJbl24kchIAXocPwa+FFYBEO+mY8t+iDaGR3sZTHK1
/Nt7kFWN2dRxaCg4Iagv38V3kV5sY/G3X6GREv05DUQ8vdzAzyUzL6byi8rr4E4H
dsSo8GegsD7SlqwqSofLAp+MmWlgcgC1l5I+npKF4XG8lUaai3ttVKT0Ulw+4YvU
7qAzlC/8xCOFnlI/Mhp7uVrtx72sl+4NHouS6FSSbF45ZoFtZnPQknLQWUUVklQ=
=iAjf
-----END PGP SIGNATURE-----



More information about the R-sig-Geo mailing list