Re: [R] Select.spatial on spplots

2009-09-28 Thread Roger Bivand

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(11,12),
 ylim = c(376,389),
 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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Select.spatial on spplots

2009-09-27 Thread Julius Tesoro
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(11,12),
ylim = c(376,389),
sp.layout=list(eq.pts),
col = heat.colors(3))

select.spatial(eq)

Cheers,

Julius Tesoro

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Select.spatial on spplots

2009-09-27 Thread cls59



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(11,12),
 ylim = c(376,389),
 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

-
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://www.nabble.com/Select.spatial-on-spplots-tp25632668p25635166.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.