Mona Eshraghi
Mona Eshraghi

Reputation: 195

Get kriging result in GML

Is it possible to have the kriging result which are coordinates and interpolated value and prediction variance in GML format?

require(gstat)
data(meuse)
coordinates(meuse) = ~x+y
data(meuse.grid)
gridded(meuse.grid) = ~x+y
m <- vgm(.59, "Sph", 874, .04)
# ordinary kriging:
x <- krige(log(zinc)~1, meuse, meuse.grid, model = m)

x contains coordinates and interpolated zinc value and associated variance. I want this in GML format that for each point I can have coordinates and values.

Upvotes: 1

Views: 167

Answers (1)

Spacedman
Spacedman

Reputation: 94237

Something like:

require(rgdal)
writeOGR(x,"x.gml","x",driver="GML")

gets you GML with this kind of feature:

 <gml:featureMember>
    <ogr:x fid="x.0">
      <ogr:geometryProperty><gml:Point><gml:coordinates>181180,333740</gml:coordinates></gml:Point></ogr:geometry
Property>
      <ogr:var1.pred>6.49662446268745</ogr:var1.pred>
      <ogr:var1.var>0.310842119817784</ogr:var1.var>
    </ogr:x>
  </gml:featureMember>

Upvotes: 4

Related Questions