Interpolasi Spatial Statistics...Praktikum 5 | Statistika Spasial rahmaanisa@apps.ipb.ac.id Outline...

Preview:

Citation preview

Interpolasi SpasialPraktikum 5 | Statistika Spasial

rahmaanisa@apps.ipb.ac.id

Outline

• Trend surface

• Thiesen Polygon

• Inverse Weight Distance

General list of techniques(points)

• trend surface - a global interpolator which calculates a best overall surface fit

• IDW - inverse distance weighting

• loess – local weighted smoothing regression (weighted quadratic least squares regression)

• spline - mathematical piecewise curve fitting

• Kriging - using geostatistical techniques

Other procedures

• Thiessen or Voronoi tessellation – area divided into regions around the sample data points where every pixel or area in the region is assigned to the data point which is the closest

• TIN - sample data points become vertices of a set of triangular facets covering the study area

Topo Data SetSpatial Topographic Data

Description: The topo data frame has 52 rows and 3 columns, oftopographic heights within a 310 feet square.

This data frame contains the following columns:

x : x coordinates (units of 50 feet)

y : y coordinates (units of 50 feet)

z : heights (feet)

Source: Davis, J.C. (1973) Statistics and Data Analysis in Geology. Wiley.

Trend surface in gstat

library(MASS)

library(raster)

library(gstat)

library(sp)

data(topo)

coordinates(topo) <- ~ x+y

plot(topo)

x=seq(0,6.3, by=0.1);y=seq(0,6.3, by=0.1)

topo.grid <- expand.grid(x=x,y=y)

gridded(topo.grid) <- ~x+y

plot(topo.grid)

1st-order trend surfacex <- gstat(formula=topo$z ~ 1, data=topo, degree=1)

kt <- predict(x, newdata=topo.grid)

spplot(kt[1], contour=TRUE,main="topo trend surface (1)-gstat")

2nd order trend surfacex <- gstat(formula=topo$z ~ 1, data=topo, degree=2)

kt2 <- predict(x, newdata=topo.grid)

p1 <- spplot( kt2[1], contour=TRUE, main="topo trend surface (2)-

gstat",sp.layout=list(list("sp.points", topo@coords, pch=19,

col=2)))

p1

Inverse Distance Weighting

• Points closer to interpolation point should have more influence

• The technique estimates the Z value at a point by weighting the influence of nearby data point according to their distance from the interpolation point.

• An exact method for topographic surfaces

• Fast

• Simple to understand and control

IDW on Topo data set

kid <- krige(topo$z ~ 1, topo, topo.grid, NULL)

spplot(kid["var1.pred"], main = "TopIDW",contour=TRUE,

sp.layout=list(list("sp.points", topo@coords, pch=19, col=2)))

Thiessen Polygons

Meuse River Data Set

Description: This data set gives locations and topsoil heavy metalconcentrations, along with a number of soil and landscape variablesat theobservation locations, collected in a flood plain of the river Meuse, near thevillage of Stein (NL). Heavy metal concentrations are from compositesamples of an area of approximately 15 m x 15 m.

This data frame contains the following columns:

x : a numeric vector; Easting (m) in Rijksdriehoek (RDH) (Netherlandstopographical) map coordinates

y : a numeric vector; Northing (m) in RDH coordinates

zinc : topsoil zinc concentration, mg kg-1 soil ("ppm")

Meuse Data Setlibrary(sp)

data(meuse)

names(meuse)

summary(meuse)

hist(meuse$zinc)

plot(meuse$x,meuse$y,asp=1)

coordinates(meuse) = ~x + y # convert data to spatial points data frame

class(meuse)[1] "SpatialPointsDataFrame"

attr(,"package")

[1] "sp"

data(meuse.grid)# this is gridded data for the meuse data set

str(meuse.grid)'data.frame': 3103 obs. of 7 variables:

$ x : num 181180 181140 181180 181220 181100 ...

$ y : num 333740 333700 333700 333700 333660 ...

$ part.a: num 1 1 1 1 1 1 1 1 1 1 ...

$ part.b: num 0 0 0 0 0 0 0 0 0 0 ...

$ dist : num 0 0 0.0122 0.0435 0 ...

$ soil : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...

$ ffreq : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...

coordinates(meuse.grid) = ~x + y # converts to spatial class

gridded(meuse.grid) <- TRUE

Thiessen Polygons

zn.tp = krige(log(zinc) ~ 1, meuse, meuse.grid, nmax = 1)

#for this search, the neighborhood is set to nmax=1

image(zn.tp["var1.pred"])

points(meuse, pch = "+", cex = 0.65)

cc = coordinates(meuse)

Thiessen Polygons

library(tripack)

plot(voronoi.mosaic(cc[, 1], cc[, 2]), do.points = FALSE, add = TRUE)

title("Thiessen (or Voronoi) polygon interpolation of log(zinc)")

Spline

• Surface created with Spline interpolation• Passes through each sample point

• May exceed the value range of the sample point set

Spline Interpolation

library(akima)

data(meuse)

meuse.zinc <- data.frame(cbind(meuse$x,

meuse$y,meuse$zinc))

par(mfcol=c(1,1))

meuse.akim <- interp(meuse.zinc$X1, meuse.zinc$X2, meuse.zinc$X3)

image(meuse.akim,,xlab="", ylab="",asp=1)

contour(meuse.akim,add=TRUE,, levels = seq(100,2000,200))

title(main="Bilinear Interpolation (Akima - default)")

points(meuse.zinc)

Choosing the Right Interpolation

• The quality of sample point set can affect choice of interpolation method as well. If the sample points are poorly distributed or there are few of them, the surface might not represent the

actual terrain very well. If we have too few sample points, add more sample points in areas

where the terrain changes abruptly or frequently, then try using Kriging.

• The real-world knowledge of the subject matter will initially affect which interpolation method to use. If it is know that some of the features in surface exceed the z value, for example, and that IDW will result in a surface that does not exceed the highest or lowest z value in the sample point

set, choose the Spline method.

• If we know that the splined surface might end up with features that we know don’t exist because Spline interpolation doesn’t work well with sample points that are close together and have

extreme differences in value, you might decide to try IDW

References

1. Anonymous. 2017. Interpolation in R. https://mgimond.github.io/Spatial/interpolation-in-r.html [17 Okt 2017]

2. [gisresource]. 2013. Choosing the Right Interpolation Method. https://www.gisresources.com/choosing-the-right-interpolation-method_2/ [17 Okt 2017)

3. Lewis, J. Spatial Interpolation: Methods for Extending Information on Spatial Data Fields.

4. Lewis, J. 2013. GEOSTAT13 Tutorial: Spatial Interpolation with R.

5. Sang. 2006. Lecture Notes: Spatial Interpolation. http://sbs.mnsu.edu/geography/people/sang/LECTURE8_SPATIAL_INTERPOLATION.pdf [17 Okt2017]

6. Pustaka lain yang relevan.

Recommended