Skip to content

sample points - sp package

2 messages · Ana, MacQueen, Don

Ana
#
When I make a sample in sp, for example a random samping of 5 points in
dataset1: 

sample.dataset1=spsample(dataset1, n = 5, "random")

I have a sp object for the selected sampling...

My question is : How can I extract from dataset2 the points & data for the
coordinates(sample.dataset1) ?

The dataset2 would be an object with the same area and coordinate system,
but I would like to extract for the coordinates of sample.dataset1 the data
in each point for dataset2.

I didn't found a way to do this in the sp package docs, but I might have
missed it.

--
View this message in context: http://r.789695.n4.nabble.com/sample-points-sp-package-tp4372673p4372673.html
Sent from the R help mailing list archive at Nabble.com.
#
I suggest you ask this question on r-sig-geo.

And it would be best if you could create a small self-contained example.

For example, what class of object is dataset2?
Is there any reason to expect that the coordinates of the sample will be
exactly the same as any of the coordinates in dataset2?

Probably, you will have to find a function that will find the point in
dataset2 that is nearest to each point in your sample. I believe there are
a few such functions among the R spatial packages, but I don't remember
any names.

-Don