Message-ID: <71F4AB24-C4E3-4823-BF56-FC161308CBC2@bryer.org>
Date: 2009-09-10T15:16:49Z
From: Jason Bryer
Subject: Looping over spatial data
Sorry for what may be a simple question. I am having an issue looping
over spatial data. Here is the code:
usa.map = read.shape(file.choose()) #Shape file of the US, 51 records
pt = data.frame(x=-73.793, y=42.857)
shapes = Map2poly(usa.map)
shape = shapes[[35]] #This is New York
pip(pt, shape) #This works, returns the point as I expect since it is
within NY
for(i in 1:length(shapes)) {
shape = shapes[[i]]
pip(pt, shape)
#This is where the error occurs
}
This is the error I get:
Error in inout(pt, shape) : NA/NaN/Inf in foreign function call (arg 4).
Thanks for any help.
-Jason