[R-sig-Geo] Inf allowed in sp SpatialPoints

Roger Bivand Roger.Bivand at nhh.no
Thu Apr 20 08:56:50 CEST 2006


On Thu, 20 Apr 2006, Michael Sumner wrote:

> Hello, thanks for all the help, BTW.
> 
> It seems that bbox coordinates in sp are tested for is.na, but not 
> is.finite.  (The only finiteness test I see
> in sp is in spDistsN1.)
> 
> Is there a good reason for this?  I can see that Inf/-Inf has meaning 
> under some scenarios, but perhaps they
> should not be allowed by default?

I agree that Inf/-Inf should not be allowed as coordinate values, in fact 
under any circumstances - any Inf or other markers ought to be in the 
attributes. We'll see if any transform/project problems arise, but these 
ought to be handled by other means. I've committed a modification to CVS 
to check bounding box values, and to prevent the Spatial object from being 
created if Inf/-Inf are present, this will be in the next release.

Thanks,

Roger

> 
> Cheers, Mike.
> >
> > library(sp)
> >
> >
> > pts <- cbind(c(147, 148, 149), c(-42, -42, -44))
> >
> > pts.na <- pts
> > pts.na[2,1] <- NA  # or NaN
> >
> > pts.inf <- pts
> > pts.inf[2,] <- Inf
> >
> > SpatialPoints(pts, CRS("+proj=longlat"))
> > SpatialPoints(pts.na)  #doesn't work,
> > SpatialPoints(pts.inf) # does work is.na(Inf) is FALSE, but plot 
> > doesn't like it
> > sessionInfo()
> R version 2.2.1, 2005-12-20, i386-pc-mingw32
> 
> attached base packages:
> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
> [7] "base"    
> 
> other attached packages:
>       sp
> "0.8-14"
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at 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 at nhh.no




More information about the R-sig-Geo mailing list