  Sorry. It seems that the above idea is not easy to get through. I tried it
for some time.
  Hope Someone else can solve it.

On Wed, Jan 27, 2010 at 10:13 PM, zhijie zhang <epistat@gmail.com> wrote:

> Hi,
>   I cannot successfully do it, but may provide my idea on this. Somebody
> else may solve it.
> ###Example Data###
> library(maptools)
> gt <- GridTopology(c(0.05,0.05), c(0.1,0.1), c(10,10))
> xv<-rnorm(length(coordinates(gt)[,1]))
> xvs<-ifelse(xv>0.2,1,0)
> grd <- SpatialGridDataFrame(gt,
> data.frame(xvs),proj4string=CRS(as.character(NA)))
> #grdM<-as.matrix(data.frame(coordinates(grd),grd@data))
> #grdM[1:5,]
> spplot(grd)
> ####Transform into polygons####
> spix <- as(grd, "SpatialPixelsDataFrame")
> spol <- as(spix, "SpatialPolygonsDataFrame")
> ####Create two subset polygons based on 0 or 1######
> spol1<-spol[spol$xvs==1,]
> plot(spol1)  #Four polygons
> spol0<-spol[spol$xvs==0,]
> plot(spol0)  #one separate grid and a large irregualr polygon
> #From their plots,we can see they can merge into four polygons for "spol1"
> and two polygons for "spol0".
> ###If we plot their neighbors, it will be more clear to see how many
> polygons there should be after merging ######
> library(spdep)
> nbs<-poly2nb(spol1, queen=TRUE)
> plot(spol1)  #Four polygons
> plot.nb(nbs, coordinates(spol1),add=TRUE)
>
> nbs2<-poly2nb(spol0, queen=TRUE)
> plot(spol0)  #Two polygons
> plot.nb(nbs2, coordinates(spol0),add=TRUE)
> ###############
>   I wonder whether it is feasible for the following idea based on the queen
> neighbors.
> Step1:We can first select one grid, and merge it with its queen neighbors.
> Then generate a new polygon for this merged grids.
> Step2: Continue to merge the newly generated polygon with its queen
> neighbors. Then generate a newer polygon for these merged grids.
>   Repeat step1 and step2 until all the related grids were merged. This is
> one separate large polygon.
>  Step3: Then select another isolated grid, and repeat the step1 and step2
> to generate another polygon.
>   Continue....Until all the separated polygons were merged.That is the
> queen neighbors will be zero finally.
>   Is this possible? Hope someone can solve this.
>   Some other ideas maybe better.
>
>
>
> On Wed, Jan 27, 2010 at 6:00 AM, <r-sig-geo-request@stat.math.ethz.ch>wrote:
>
>> Send R-sig-Geo mailing list submissions to
>>        r-sig-geo@stat.math.ethz.ch
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>        https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> or, via email, send a message with subject or body 'help' to
>>        r-sig-geo-request@stat.math.ethz.ch
>>
>> You can reach the person managing the list at
>>        r-sig-geo-owner@stat.math.ethz.ch
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of R-sig-Geo digest..."
>>
>>
>> Today's Topics:
>>
>>   1. Re: rgdal 64bit Windows version? (Rainer Hurling)
>>   2. Re: points to lines and/or polygons (Roger Bivand)
>>   3. Distance to (nearest) polygon (Karl Ove Hufthammer)
>>   4. Re: Distance to (nearest) polygon (Roger Bivand)
>>   5. maxdist for kriging with an external drift (Els Verfaillie)
>>   6. Re: maxdist for kriging with an external drift (Edzer Pebesma)
>>   7. Re: maxdist for kriging with an external drift
>>      (Cutberto Uriel Paredes Hern?ndez)
>>   8. Edit a Sptial Lines Object (Rodrigo Aluizio)
>>   9. Re: maxdist for kriging with an external drift (Edzer Pebesma)
>>  10. Re: maxdist for kriging with an external drift
>>      (Paulo Justiniano Ribeiro Jr)
>>  11. Convert grids with 0/1 attribute to polygons with neighbor
>>      grids of same values merged (rusers.sh)
>>  12. Re: complement part of a polygon in another polygon (rusers.sh)
>>  13. kriging as fish swim, not as crows fly (Martin Renner)
>>  14. Re: Distance to (nearest) polygon (Karl Ove Hufthammer)
>>  15. Re: kriging as fish swim, not as crows fly (Michael Sumner)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 26 Jan 2010 12:01:45 +0100
>> From: Rainer Hurling <rhurlin@gwdg.de>
>> To: Michael Sumner <mdsumner@gmail.com>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] rgdal 64bit Windows version?
>> Message-ID: <4B5ECB99.4040602@gwdg.de>
>> Content-Type: text/plain; charset=UTF-8; format=flowed
>>
>> Am 25.01.2010 22:25 (UTC+1) schrieb Michael Sumner:
>> > I suspect you'll need to build GDAL for yourself and then build rgdal
>> > on top of that, since rgdal depends upon a pre-installation of GDAL.
>> > The gdal-dev list is the appropriate place for discussing the first
>> > step.
>> >
>> > Colleagues have succesfully built 64-bit Windows GDAL from the 1.6.0
>> > release using extra binaries (HDF4/5, NetCDF, etc.) from here:
>> > http://vbkto.dyndns.org:1280/sdk/Default.aspx
>>
>> Thanks, Michael, for this interesting link.
>>
>> Unfortunately we are not able to build our own versions on windows
>> machines because of administrative reasons. I will have a look at it in
>> my spare time ;-)
>>
>> Rainer
>>
>> > There are notes on build rgdal for Windows here, but I've not done it
>> > myself for a while:
>> >
>> > file.show(system.file("README.windows", package="rgdal"))
>> >
>> > I am keen to try this for myself, but it will not be for a while yet.
>> >
>> > Best regards,
>> > Mike
>> >
>> > On Tue, Jan 26, 2010 at 8:04 AM, Rainer Hurling<rhurlin@gwdg.de>
>>  wrote:
>> >> Some days ago Brian Ripley and Uwe Ligges announced an update to
>> MinGW-w64
>> >> builds for 64-bit Windows on R-devel@. This daily version works really
>> nice.
>> >> But it is not fully applicable at this time because of some missing
>> >> packages.
>> >>
>> >> I am in particular interested in a 64-bit version of rgdal, which
>> depends on
>> >> a 64-bit version of gdal(.dll). Is their anything known about what is
>> >> planned with this important part of spatial software?
>>
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Tue, 26 Jan 2010 13:54:27 +0100 (CET)
>> From: Roger Bivand <Roger.Bivand@nhh.no>
>> To: Agustin Lobo <alobolistas@gmail.com>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] points to lines and/or polygons
>> Message-ID: <alpine.LRH.2.00.1001261350580.14929@reclus.nhh.no>
>> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>>
>> On Tue, 26 Jan 2010, Agustin Lobo wrote:
>>
>> > Hi!
>> > Package StatDA
>> > provides background geoinformation as a set of coordinates:
>> >> str(kola.background)
>> > List of 4
>> > $ boundary:'data.frame':       50 obs. of  2 variables:
>> >  ..$ V1: num [1:50] 388650 388160 386587 384035 383029 ...
>> >  ..$ V2: num [1:50] 7892400 7881248 7847303 7790797 7769214 ...
>> > $ coast   :'data.frame':       6259 obs. of  2 variables:
>> >  ..$ V1: num [1:6259] 438431 439102 439102 439643 439643 ...
>> >  ..$ V2: num [1:6259] 7895619 7896495 7896495 7895800 7895542 ...
>> > $ borders :'data.frame':       504 obs. of  2 variables:
>> >  ..$ V1: num [1:504] 417575 417704 418890 420308 422731 ...
>> >  ..$ V2: num [1:504] 7612984 7612984 7613293 7614530 7615972 ...
>> > $ lakes   :'data.frame':       6003 obs. of  2 variables:
>> >  ..$ V1: num [1:6003] 547972 546915 NA 547972 547172 ...
>> >  ..$ V2: num [1:6003] 7815109 7815599 NA 7815109 7813873 ...
>> >
>> > is there any spatial function aready availale to convert these
>> coordinates
>> > into Spatial Lines and Spatial Polygons?
>>
>> This seems to work at least for SpatialLines - for polygons, the rings may
>> need to be closed:
>>
>> library(StatDA)
>> data(kola.background)
>> xy <- kola.background$boundary
>> names(xy) <- c("x", "y")
>> library(maptools)
>> bdy <- map2SpatialLines(xy)
>> plot(bdy)
>>
>> The data are in the legacy S format (like the maps package).
>>
>> Roger
>>
>>
>> >
>> > Thanks
>> >
>> > Agus
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo@stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>> --
>> Roger Bivand
>> Economic Geography Section, Department of Economics, Norwegian School of
>> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
>> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
>> e-mail: Roger.Bivand@nhh.no
>>
>>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Tue, 26 Jan 2010 16:02:27 +0100
>> From: Karl Ove Hufthammer <karl@huftis.org>
>> To: r-sig-geo@stat.math.ethz.ch
>> Subject: [R-sig-Geo] Distance to (nearest) polygon
>> Message-ID: <MPG.25c9226ee5625bb49896d3@news.gmane.org>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> Dear list members
>>
>> Is there an easy and preferably fast way to measure the distance from a
>> of (large) number of points to the nearest polygon? spDistsN1 seems to
>> only want to measure the distance between points.
>>
>> For example, I need the distance between points at sea to the nearest
>> land area (as defined by for example the 'world' dataset).
>>
>> It's not very important which polygon, e.g., country, the given distance
>> is to. It would be nice if the 'distance' from points that are inside
>> the polygons were zero or negative, but it's not required -- distance to
>> the polygon border, e.g., shoreline, would be OK.
>>
>> --
>> Karl Ove Hufthammer
>>
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Tue, 26 Jan 2010 16:27:23 +0100 (CET)
>> From: Roger Bivand <Roger.Bivand@nhh.no>
>> To: Karl Ove Hufthammer <karl@huftis.org>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] Distance to (nearest) polygon
>> Message-ID: <alpine.LRH.2.00.1001261625260.17754@reclus.nhh.no>
>> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>>
>> On Tue, 26 Jan 2010, Karl Ove Hufthammer wrote:
>>
>> > Dear list members
>> >
>> > Is there an easy and preferably fast way to measure the distance from a
>> > of (large) number of points to the nearest polygon? spDistsN1 seems to
>> > only want to measure the distance between points.
>> >
>> > For example, I need the distance between points at sea to the nearest
>> > land area (as defined by for example the 'world' dataset).
>> >
>> > It's not very important which polygon, e.g., country, the given distance
>> > is to. It would be nice if the 'distance' from points that are inside
>> > the polygons were zero or negative, but it's not required -- distance to
>> > the polygon border, e.g., shoreline, would be OK.
>>
>> There are methods for point to line segment distances in spatstat.
>> Further, for projected (planar) coordinates, this could be added to
>> R-Forge rgeos; for geographical coordinates Boost ggl would be needed.
>>
>> Roger
>>
>> >
>> >
>>
>> --
>> Roger Bivand
>> Economic Geography Section, Department of Economics, Norwegian School of
>> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
>> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
>> e-mail: Roger.Bivand@nhh.no
>>
>>
>>
>> ------------------------------
>>
>> Message: 5
>> Date: Tue, 26 Jan 2010 17:00:29 +0100
>> From: "Els Verfaillie" <els.verfaillie@ugent.be>
>> To: <r-sig-geo@stat.math.ethz.ch>
>> Subject: [R-sig-Geo] maxdist for kriging with an external drift
>> Message-ID: <005d01ca9ea0$aed17900$0c746b00$@verfaillie@ugent.be>
>> Content-Type: text/plain
>>
>> Dear list,
>>
>>
>>
>> I want to use Kriging with an external drift for a sedimentological
>> dataset
>> of grain-size that has a linear relation with the depth.
>>
>> Am I correct that when I set a 'maxdist' using the krige command, that a
>> trend for the primary variable (grain-size) is calculated as a local
>> linear
>> function of the secondary variable (depth)? Is this function thus
>> different
>> for each interpolation window?
>>
>>
>>
>> d50.ked.dir50 <- krige(D50F~depth, locations=ds50, newdata=Depth,
>> model=d50.fit.var.50, nmin=2, nmax=16, maxdist=9000)
>>
>>
>>
>> Thank you for your help.
>>
>>
>>
>> Best regards,
>>
>> Els Verfaillie
>>
>>
>>
>> ______________________________________________
>>
>> Dr. Els Verfaillie
>>
>> Carto-GIS cluster
>>
>> Ghent University (UGent) - Department of Geography
>>
>> ______________________________________________
>>
>>
>>
>>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>>
>>
>> ------------------------------
>>
>> Message: 6
>> Date: Tue, 26 Jan 2010 17:05:03 +0100
>> From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
>> To: Els Verfaillie <els.verfaillie@ugent.be>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] maxdist for kriging with an external drift
>> Message-ID: <4B5F12AF.5070302@uni-muenster.de>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Yes, that is right.
>>
>> Els Verfaillie wrote:
>> > Dear list,
>> >
>> >
>> >
>> > I want to use Kriging with an external drift for a sedimentological
>> dataset
>> > of grain-size that has a linear relation with the depth.
>> >
>> > Am I correct that when I set a 'maxdist' using the krige command, that a
>> > trend for the primary variable (grain-size) is calculated as a local
>> linear
>> > function of the secondary variable (depth)? Is this function thus
>> different
>> > for each interpolation window?
>> >
>> >
>> >
>> > d50.ked.dir50 <- krige(D50F~depth, locations=ds50, newdata=Depth,
>> > model=d50.fit.var.50, nmin=2, nmax=16, maxdist=9000)
>> >
>> >
>> >
>> > Thank you for your help.
>> >
>> >
>> >
>> > Best regards,
>> >
>> > Els Verfaillie
>> >
>> >
>> >
>> > ______________________________________________
>> >
>> > Dr. Els Verfaillie
>> >
>> > Carto-GIS cluster
>> >
>> > Ghent University (UGent) - Department of Geography
>> >
>> > ______________________________________________
>> >
>> >
>> >
>> >
>> >
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo@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.52north.org/geostatistics      e.pebesma@wwu.de
>>
>>
>>
>> ------------------------------
>>
>> Message: 7
>> Date: Tue, 26 Jan 2010 16:45:00 +0000
>> From: Cutberto Uriel Paredes Hern?ndez  <cutberto.paredes@gmail.com>
>> To: Edzer Pebesma <edzer.pebesma@uni-muenster.de>,
>>        r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] maxdist for kriging with an external drift
>> Message-ID:
>>        <8f1fabf91001260845n632ad13ek418a695e27110de8@mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Dear Edzer,
>>
>> Would it be correct to say then that if a neighbourhood is specified
>> in the krige command the result would be that of Kriging with an
>> External Drift (KED), otherwise it would be that of Simple Kriging
>> with varying local means (SKlm)?
>>
>> Apologies for posting on this thread but I was about to post a
>> similiar question.
>>
>> Thanks, Cutberto.
>>
>> 2010/1/26 Edzer Pebesma <edzer.pebesma@uni-muenster.de>:
>> > Yes, that is right.
>> >
>> > Els Verfaillie wrote:
>> >>
>> >> Dear list,
>> >>
>> >>
>> >> I want to use Kriging with an external drift for a sedimentological
>> >> dataset
>> >> of grain-size that has a linear relation with the depth.
>> >> Am I correct that when I set a 'maxdist' using the krige command, that
>> a
>> >> trend for the primary variable (grain-size) is calculated as a local
>> >> linear
>> >> function of the secondary variable (depth)? Is this function thus
>> >> different
>> >> for each interpolation window?
>> >>
>> >> d50.ked.dir50 <- krige(D50F~depth, locations=ds50, newdata=Depth,
>> >> model=d50.fit.var.50, nmin=2, nmax=16, maxdist=9000)
>> >>
>> >>
>> >> Thank you for your help.
>> >>
>> >>
>> >> Best regards,
>> >>
>> >> Els Verfaillie
>> >>
>> >>
>> >> ______________________________________________
>> >>
>> >> Dr. Els Verfaillie
>> >>
>> >> Carto-GIS cluster
>> >>
>> >> Ghent University (UGent) - Department of Geography
>> >>
>> >> ______________________________________________
>> >>
>> >>
>> >>
>> >>
>> >> ? ? ? ?[[alternative HTML version deleted]]
>> >>
>> >> _______________________________________________
>> >> R-sig-Geo mailing list
>> >> R-sig-Geo@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.52north.org/geostatistics
>> > ?e.pebesma@wwu.de
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo@stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>>
>>
>> ------------------------------
>>
>> Message: 8
>> Date: Tue, 26 Jan 2010 15:02:40 -0200
>> From: "Rodrigo Aluizio" <r.aluizio@gmail.com>
>> To: "R Help" <r-sig-geo@stat.math.ethz.ch>
>> Subject: [R-sig-Geo] Edit a Sptial Lines Object
>> Message-ID: <4b5f2052.9c15f10a.7b9d.0861@mx.google.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Hi list, I?m trying to insert some coordinates at the end of an object
>> (attached) component (BP[1]).
>>
>> But I?m not able to do so. I can?t isolate the coordinates, if I use the
>> ?@lines? it turns into a list, but I need to keep the SpatialLines and S4
>> structure, then I will be able to transform the closed lines into
>> polygons.
>>
>> So, How can I insert the coordinates that will close the BP[1] line into
>> this object without changing the object properties. Any Ideas?
>>
>> Thank you in advance.
>>
>>
>>
>> -------------------------------------------------------------
>>
>> MSc.  <mailto:r.aluizio@gmail.com> Rodrigo Aluizio
>>
>> Centro de Estudos do Mar/UFPR
>> Laborat?rio de Micropaleontologia
>> Avenida Beira Mar s/n - CEP 83255-000
>> Pontal do Paran? - PR - Brasil
>> Fone: (41) 3511-8657
>>
>> Fax: (41) 3455-3623
>>
>>
>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100126/63ec934e/attachment-0001.html
>> >
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: BP.Rdata
>> Type: application/octet-stream
>> Size: 39731 bytes
>> Desc: not available
>> URL: <
>> https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100126/63ec934e/attachment-0001.obj
>> >
>>
>> ------------------------------
>>
>> Message: 9
>> Date: Tue, 26 Jan 2010 21:11:47 +0100
>> From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
>> To: Cutberto Uriel Paredes Hern?ndez    <cutberto.paredes@gmail.com>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] maxdist for kriging with an external drift
>> Message-ID: <4B5F4C83.7040808@uni-muenster.de>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Oh, geostatistics and its funny naming conventions!
>>
>> I see local models vs. global models as a completely different modelling
>> aspect (model decision, basically) then the SK/OK/UK differences. When
>> building on the same tradition / body of literature you quote: in that
>> case KED would be a special form of UK, having only a single
>> non-coordinate predictor called 'external drift'.
>>
>> In my eyes (and that of the literature with more mathematical
>> statistical grounding, such as Cressie 1993 and others), the difference
>> between SK on the one hand and OK/UK on the other is that SK assumes
>> that you know the mean or mean structure. SKlm is then residual kriging
>> added to a known mean function.
>>
>> In the gstat R package you obtain SK by specifying a beta value (for the
>> mean); SKlm by specifying one or more predictors and passing the (known)
>> regression coefficients as beta; you obtain OK/UK by not specifying
>> beta; a formula ending on ~1 results in OK with an unknown mean only.
>>
>> Ah, and then SK = simple kriging, OK = ordinary kriging, UK = universal
>> kriging.
>> --
>> Edzer
>>
>> Cutberto Uriel Paredes Hern?ndez wrote:
>> > Dear Edzer,
>> >
>> > Would it be correct to say then that if a neighbourhood is specified
>> > in the krige command the result would be that of Kriging with an
>> > External Drift (KED), otherwise it would be that of Simple Kriging
>> > with varying local means (SKlm)?
>> >
>> > Apologies for posting on this thread but I was about to post a
>> > similiar question.
>> >
>> > Thanks, Cutberto.
>> >
>> > 2010/1/26 Edzer Pebesma <edzer.pebesma@uni-muenster.de>:
>> >
>> >> Yes, that is right.
>> >>
>> >> Els Verfaillie wrote:
>> >>
>> >>> Dear list,
>> >>>
>> >>>
>> >>> I want to use Kriging with an external drift for a sedimentological
>> >>> dataset
>> >>> of grain-size that has a linear relation with the depth.
>> >>> Am I correct that when I set a 'maxdist' using the krige command, that
>> a
>> >>> trend for the primary variable (grain-size) is calculated as a local
>> >>> linear
>> >>> function of the secondary variable (depth)? Is this function thus
>> >>> different
>> >>> for each interpolation window?
>> >>>
>> >>> d50.ked.dir50 <- krige(D50F~depth, locations=ds50, newdata=Depth,
>> >>> model=d50.fit.var.50, nmin=2, nmax=16, maxdist=9000)
>> >>>
>> >>>
>> >>> Thank you for your help.
>> >>>
>> >>>
>> >>> Best regards,
>> >>>
>> >>> Els Verfaillie
>> >>>
>> >>>
>> >>> ______________________________________________
>> >>>
>> >>> Dr. Els Verfaillie
>> >>>
>> >>> Carto-GIS cluster
>> >>>
>> >>> Ghent University (UGent) - Department of Geography
>> >>>
>> >>> ______________________________________________
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>        [[alternative HTML version deleted]]
>> >>>
>> >>> _______________________________________________
>> >>> R-sig-Geo mailing list
>> >>> R-sig-Geo@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.52north.org/geostatistics
>> >>  e.pebesma@wwu.de
>> >>
>> >> _______________________________________________
>> >> R-sig-Geo mailing list
>> >> R-sig-Geo@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.52north.org/geostatistics      e.pebesma@wwu.de
>>
>>
>>
>> ------------------------------
>>
>> Message: 10
>> Date: Tue, 26 Jan 2010 18:31:00 -0200 (BRST)
>> From: Paulo Justiniano Ribeiro Jr <paulojus@c3sl.ufpr.br>
>> To: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] maxdist for kriging with an external drift
>> Message-ID: <alpine.DEB.1.10.1001261822570.28905@dalmore.c3sl.ufpr.br>
>> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>>
>> May be worth adding here that, despite algorithms and the
>> "funny naming conventions" (good descrition Edzer!)
>> SK and others are diferent in the following way:
>>
>> SK, as described in Edzer post, assumes you **know** the mean, in other
>> words, there is no uncertainty about it.
>> On the other hand, variants such as OK, UK, KED, SKlm uses (explicitly
>> or implicitly) estimated means.
>> Therefore, such uncertainty has to be propagated and reflected in the
>> predictions.
>>
>> Suposse the fixed mean in SK is the same as the (implicitly) estimated by
>> OK. The point predictions will be the same, however, the uncertainty
>> around them will not (and should not) refleting  the uncertainty (or lack
>> of it) in the process mean.
>> The prediction variance expressions for SK ond OK will reflect this
>> whatever the kriging neighborhood is used.
>>
>> best
>> P.J.
>>
>> On Tue, 26 Jan 2010, Edzer Pebesma wrote:
>>
>> > Oh, geostatistics and its funny naming conventions!
>> >
>> > I see local models vs. global models as a completely different modelling
>> > aspect (model decision, basically) then the SK/OK/UK differences. When
>> > building on the same tradition / body of literature you quote: in that
>> case
>> > KED would be a special form of UK, having only a single non-coordinate
>> > predictor called 'external drift'.
>> >
>> > In my eyes (and that of the literature with more mathematical
>> statistical
>> > grounding, such as Cressie 1993 and others), the difference between SK
>> on the
>> > one hand and OK/UK on the other is that SK assumes that you know the
>> mean or
>> > mean structure. SKlm is then residual kriging added to a known mean
>> function.
>> >
>> > In the gstat R package you obtain SK by specifying a beta value (for the
>> > mean); SKlm by specifying one or more predictors and passing the (known)
>> > regression coefficients as beta; you obtain OK/UK by not specifying
>> beta; a
>> > formula ending on ~1 results in OK with an unknown mean only.
>> >
>> > Ah, and then SK = simple kriging, OK = ordinary kriging, UK = universal
>> > kriging.
>> > --
>> > Edzer
>> >
>> > Cutberto Uriel Paredes Hern?ndez wrote:
>> >> Dear Edzer,
>> >>
>> >> Would it be correct to say then that if a neighbourhood is specified
>> >> in the krige command the result would be that of Kriging with an
>> >> External Drift (KED), otherwise it would be that of Simple Kriging
>> >> with varying local means (SKlm)?
>> >>
>> >> Apologies for posting on this thread but I was about to post a
>> >> similiar question.
>> >>
>> >> Thanks, Cutberto.
>> >>
>> >> 2010/1/26 Edzer Pebesma <edzer.pebesma@uni-muenster.de>:
>> >>
>> >>> Yes, that is right.
>> >>>
>> >>> Els Verfaillie wrote:
>> >>>
>> >>>> Dear list,
>> >>>>
>> >>>>
>> >>>> I want to use Kriging with an external drift for a sedimentological
>> >>>> dataset
>> >>>> of grain-size that has a linear relation with the depth.
>> >>>> Am I correct that when I set a 'maxdist' using the krige command,
>> that a
>> >>>> trend for the primary variable (grain-size) is calculated as a local
>> >>>> linear
>> >>>> function of the secondary variable (depth)? Is this function thus
>> >>>> different
>> >>>> for each interpolation window?
>> >>>>
>> >>>> d50.ked.dir50 <- krige(D50F~depth, locations=ds50, newdata=Depth,
>> >>>> model=d50.fit.var.50, nmin=2, nmax=16, maxdist=9000)
>> >>>>
>> >>>>
>> >>>> Thank you for your help.
>> >>>>
>> >>>>
>> >>>> Best regards,
>> >>>>
>> >>>> Els Verfaillie
>> >>>>
>> >>>>
>> >>>> ______________________________________________
>> >>>>
>> >>>> Dr. Els Verfaillie
>> >>>>
>> >>>> Carto-GIS cluster
>> >>>>
>> >>>> Ghent University (UGent) - Department of Geography
>> >>>>
>> >>>> ______________________________________________
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>        [[alternative HTML version deleted]]
>> >>>>
>> >>>> _______________________________________________
>> >>>> R-sig-Geo mailing list
>> >>>> R-sig-Geo@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.52north.org/geostatistics
>> >>>  e.pebesma@wwu.de
>> >>>
>> >>> _______________________________________________
>> >>> R-sig-Geo mailing list
>> >>> R-sig-Geo@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.52north.org/geostatistics
>> > e.pebesma@wwu.de
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo@stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>> Paulo Justiniano Ribeiro Jr
>> LEG (Laboratorio de Estatistica e Geoinformacao)
>> Universidade Federal do Parana
>> Caixa Postal 19.081
>> CEP 81.531-990
>> Curitiba, PR  -  Brasil
>> Tel: (+55) 41 3361 3573
>> Fax: (+55) 41 3361 3141
>> e-mail: paulojus AT  ufpr  br
>> http://www.leg.ufpr.br/~paulojus
>>
>>
>>
>> ------------------------------
>>
>> Message: 11
>> Date: Tue, 26 Jan 2010 22:53:15 -0500
>> From: "rusers.sh" <rusers.sh@gmail.com>
>> To: r-sig-geo@stat.math.ethz.ch
>> Subject: [R-sig-Geo] Convert grids with 0/1 attribute to polygons with
>>        neighbor grids of same values merged
>> Message-ID:
>>        <a835c81e1001261953w69656b0cg3400793f92a4a412@mail.gmail.com>
>> Content-Type: text/plain
>>
>> Dear all,
>>  Somebody has discussed the similar question before, "converting grid
>> objects to spatial polygon objects and export as shapefile (
>> https://stat.ethz.ch/pipermail/r-sig-geo/2009-December/007163.html)",
>> where
>> they have successfully convert the grids into spatial polygons. But the
>> generated polygons didnot merge any original grids.
>>   Now, i have a grid dataset, its attribute is 0/1 variable. So finally i
>> hope to get two shape files, one is its attribute being 0, another
>> is attribute being 1. But particularly, i hope to merge the grids if their
>> attribute's values are same, so the final polygon maybe irregular,which is
>> different from the previous post. Note each shape files may have several
>> polygons after merging because the grids with same value are not all in
>> the
>> similar positions. That means i only want to merge those close grids with
>> same value in adjacent positions, and not expect to generate a big polygon
>> with some holes in it.The main problem maybe how to merge those adjacent
>> grids with same values into polygons.
>> #Example data
>> gt <- GridTopology(c(0.05,0.05), c(0.1,0.1), c(10,10))
>> xv<-rnorm(length(coordinates(gt)[,1]))
>> xvs<-ifelse(xv>0.2,1,0)
>> grd <- SpatialGridDataFrame(gt,
>> data.frame(xvs),proj4string=CRS(as.character(NA)))
>> grdM<-as.matrix(data.frame(coordinates(grd),grd@data))
>> grdM[1:5,]
>>  Any ideas on this? I'd appreciate any suggestions or help.
>>  Thanks.
>>
>> --
>> -----------------
>> Jane Chang
>> Queen's
>>
>>        [[alternative HTML version deleted]]
>>
>>
>>
>> ------------------------------
>>
>> Message: 12
>> Date: Tue, 26 Jan 2010 23:26:18 -0500
>> From: "rusers.sh" <rusers.sh@gmail.com>
>> To: Alexandre Villers <alexandre.villersav@laposte.net>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] complement part of a polygon in another
>>        polygon
>> Message-ID:
>>        <a835c81e1001262026ub45a630v8bad1297a756771b@mail.gmail.com>
>> Content-Type: text/plain
>>
>> intersect.owin() works for intersection.
>>  Say polygon B located inside A. Is there any function in R for us to get
>> the complement part of  B in  polygon A?
>>
>> 2010/1/26 Alexandre Villers <alexandre.villersav@laposte.net>
>>
>> > Good morning,
>> >
>> > You can have a look at union.owin() and intersection.owin() in spatstat.
>> > You just need to convert from so objects to spatstat object and back...
>> > Best regards
>> >
>> > Alex
>> >
>> >
>>
>>
>> --
>> -----------------
>> Jane Chang
>> Queen's
>>
>>        [[alternative HTML version deleted]]
>>
>>
>>
>> ------------------------------
>>
>> Message: 13
>> Date: Tue, 26 Jan 2010 23:06:41 -0900
>> From: Martin Renner <martin.renner@stonebow.otago.ac.nz>
>> To: r-sig-geo@stat.math.ethz.ch
>> Subject: [R-sig-Geo] kriging as fish swim, not as crows fly
>> Message-ID:
>>        <498D5289-7BAA-4D6E-BE6B-F202895BFEF2@stonebow.otago.ac.nz>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Hi All,
>>
>> I want to kirg fish and seabird densities within an estuary which has
>> several arms. Since neither organisms cross land, the appropriate distances
>> would not be euclidian but over-water (as fish swim). There are several
>> papers, describing this problem and how to deal with it (see below), but I
>> have not found an easily accessible implementation. Is anybody aware of a
>> solution in R?
>>
>> Best,
>> Martin
>>
>>
>>
>> @article{Rathbun:1998aa,
>>        Author = {Rathbun, Stephen L.},
>>        Journal = {Environmetrics},
>>        Number = {2},
>>        Pages = {109--129},
>>        Title = {Spatial modelling in irregularly shaped regions: kriging
>> estuaries},
>>        Volume = {9},
>>        Year = {1998}}
>>
>> @article{Little:1997aa,
>>        Author = {Little, Laurie S. and Edwards, Don and Porter, Dwayne
>> E.},
>>        Journal = {Journal of Experimental Marine Biology and Ecology},
>>        Number = {1},
>>        Pages = {1--11},
>>        Title = {Kriging in estuaries: as the crow flies, or as the fish
>> swims?},
>>        Volume = {213},
>>        Year = {1997}}
>>
>>
>>
>>
>> Martin Renner
>> US Geological Survey
>> Alaska Science Center
>>
>>
>>
>> ------------------------------
>>
>> Message: 14
>> Date: Wed, 27 Jan 2010 10:17:12 +0100
>> From: Karl Ove Hufthammer <karl@huftis.org>
>> To: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] Distance to (nearest) polygon
>> Message-ID: <MPG.25ca23071e15ccd89896d4@news.gmane.org>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> On Tue, 26 Jan 2010 16:27:23 +0100 (CET) Roger Bivand
>> <Roger.Bivand@nhh.no> wrote:
>>
>> >> For example, I need the distance between points at sea to the nearest
>> >> land area (as defined by for example the 'world' dataset).
>> >
>> > There are methods for point to line segment distances in spatstat.
>> > Further, for projected (planar) coordinates, this could be added to
>> > R-Forge rgeos; for geographical coordinates Boost ggl would be needed.
>>
>> Thanks. The 'nncross' function in 'spatstat' does essentially do what I
>> need. Unfortunately, I work with geographical coordinates (spanning
>> about 15 degrees of latitude), so the results are not perfect (using
>> plain long/lat coordinates), but they will probably be an adequate
>> approximation.
>>
>> BTW, for my application, I'm not interested in the distance per se, only
>> in the points (e.g., boats) within a certain distance from the polygon
>> (land). So I have also thought about a possible solution of using an
>> expanded polygon, expanded in a certain number of kilometers outwards,
>> and then using point-in-polygon (i.e., 'overlay') to find the points
>> that are inside this new polygon. But I couldn't find a function to
>> 'grow' a polygon in this way.
>>
>> --
>> Karl Ove Hufthammer
>>
>>
>>
>> ------------------------------
>>
>> Message: 15
>> Date: Wed, 27 Jan 2010 20:29:15 +1100
>> From: Michael Sumner <mdsumner@gmail.com>
>> To: Martin Renner <martin.renner@stonebow.otago.ac.nz>
>> Cc: r-sig-geo@stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] kriging as fish swim, not as crows fly
>> Message-ID:
>>        <522664f81001270129g2a80ea2n62e8e6c3442fc7e@mail.gmail.com>
>> Content-Type: text/plain; charset=UTF-8
>>
>> Not kriging as such, but check out the soap-film smoothing in package
>> mgcv:
>>
>> http://www.maths.bath.ac.uk/~sw283/simon/papers/soap.pdf
>>
>> FWIW, there are binning methods with MCMC in the package
>> tripEstimation that have similar features, but they are particularly
>> focussed on individual track estimation and probably not easily
>> applied. Is location uncertainty a big issue for your data? What are
>> the input locations?
>>
>> Cheers, Mike.
>>
>>
>> On Wed, Jan 27, 2010 at 7:06 PM, Martin Renner
>> <martin.renner@stonebow.otago.ac.nz> wrote:
>> > Hi All,
>> >
>> > I want to kirg fish and seabird densities within an estuary which has
>> several arms. Since neither organisms cross land, the appropriate distances
>> would not be euclidian but over-water (as fish swim). There are several
>> papers, describing this problem and how to deal with it (see below), but I
>> have not found an easily accessible implementation. Is anybody aware of a
>> solution in R?
>> >
>> > Best,
>> > Martin
>> >
>> >
>> >
>> > @article{Rathbun:1998aa,
>> > ? ? ? ?Author = {Rathbun, Stephen L.},
>> > ? ? ? ?Journal = {Environmetrics},
>> > ? ? ? ?Number = {2},
>> > ? ? ? ?Pages = {109--129},
>> > ? ? ? ?Title = {Spatial modelling in irregularly shaped regions: kriging
>> estuaries},
>> > ? ? ? ?Volume = {9},
>> > ? ? ? ?Year = {1998}}
>> >
>> > @article{Little:1997aa,
>> > ? ? ? ?Author = {Little, Laurie S. and Edwards, Don and Porter, Dwayne
>> E.},
>> > ? ? ? ?Journal = {Journal of Experimental Marine Biology and Ecology},
>> > ? ? ? ?Number = {1},
>> > ? ? ? ?Pages = {1--11},
>> > ? ? ? ?Title = {Kriging in estuaries: as the crow flies, or as the fish
>> swims?},
>> > ? ? ? ?Volume = {213},
>> > ? ? ? ?Year = {1997}}
>> >
>> >
>> >
>> >
>> > Martin Renner
>> > US Geological Survey
>> > Alaska Science Center
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo@stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>> End of R-sig-Geo Digest, Vol 77, Issue 24
>> *****************************************
>>
>
>
>
> --
> With Kind Regards,
>
> oooO:::::::::
> (..):::::::::
> :\.(:::Oooo::
> ::\_)::(..)::
> :::::::)./:::
> ::::::(_/::::
> :::::::::::::
> [***********************************************************************]
> ZhiJie Zhang ,PhD
> Dept.of Epidemiology, School of Public Health,Fudan University
> Office:Room 443, Building 8
> Office Tel./Fax.:+86-21-54237410
> Address:No. 138 Yi Xue Yuan Road,Shanghai,China
> Postcode:200032
> Email:epistat@gmail.com <Email%3Aepistat@gmail.com>
> Website: www.statABC.com
> [***********************************************************************]
> oooO:::::::::
> (..):::::::::
> :\.(:::Oooo::
> ::\_)::(..)::
> :::::::)./:::
> ::::::(_/::::
> :::::::::::::
>



-- 
With Kind Regards,

oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[***********************************************************************]
ZhiJie Zhang ,PhD
Dept.of Epidemiology, School of Public Health,Fudan University
Office:Room 443, Building 8
Office Tel./Fax.:+86-21-54237410
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:epistat@gmail.com <Email%3Aepistat@gmail.com>
Website: www.statABC.com
[***********************************************************************]
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::

	[[alternative HTML version deleted]]

