[R] Select.spatial on spplots

Roger Bivand Roger.Bivand at nhh.no
Mon Sep 28 22:35:32 CEST 2009


Charlie's reply is quite correct - without an example that others can
reproduce, it is hard to offer help. Julius is also ignoring the fact that
spplot() methods use lattice graphics, while select.spatial() uses base
graphics. The spplot() method for SpatialPointsDataFrames objects does
provide an identify= argument, but this is not the same as select.spatial(),
which lets the user select points spatially by drawing a polygon around the
ones to be selected.

Roger Bivand



cls59 wrote:
> 
> 
> 
> Julius Tesoro wrote:
>> 
>> Hi everyone. I posted this on R-sig-geo but got no response. 
>> 
>>  
>> Can select.spatial() be used in an existing spplot? I have tried
>> selecting points (eq) from a plot generated from sp. However, when I
>> invoke select.spatial(eq). It generates only the points without the
>> background containing the faults. I need the background to select which
>> earthquakes coalesce on which fault. Is there an alternative?
>> 
>> eq.pts<-list("sp.points",eq, col="blue", lwd=0.5, pch = 4)
>>    
>> spplot(faults,"Dip", xlim = c(110000,120000),
>>         ylim = c(3760000,3890000),
>>         sp.layout=list(eq.pts),
>>         col = heat.colors(3))
>> 
>> select.spatial(eq)
>> 
>> Cheers,
>> 
>> Julius Tesoro
>> 
>> 
> 
> 
> Unfortunately, it looks like select.spatial() wipes the plotting region by
> executing it's own call to plot(). However, the function it's self is
> very, very simple, just type:
> 
> select.spatial
> 
> To see what goes on inside. It looks like you could obtain point-wise
> selection by just calling identify():
> 
> identify( coordinates( eq )[,1], coordinates( eq )[,2]
> 
> To use areas, call locator() and then process the results using
> point.in.polygon().
> 
> As for whether this will work using a spplot-- I really couldn't say. I
> was not able to reproduce a spplot using the information you provided--
> lack of a working example may be a reason you got nothing but silence on
> R-sig-geo.
> 
> Good luck!
> 
> -Charlie
> 

-- 
View this message in context: http://www.nabble.com/Select.spatial-on-spplots-tp25632668p25652492.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list