Skip to content
Back to formatted view

Raw Message

Message-ID: <84318df7-6a5d-ae56-66ca-81bc29638c61@uni-muenster.de>
Date: 2019-05-07T18:39:32Z
From: Edzer Pebesma
Subject: Semi-join?
In-Reply-To: <CANnL8gqt_caM76GBUyhF233D1VQNab6dxCsXX-jHE+9A9aOHbQ@mail.gmail.com>

On 5/7/19 8:29 PM, Tim Keitt wrote:
> I keep finding things that are trivial in sql are not so in R, so perhaps
> you can help me out.
> 
> What would be the way in the 'sf' package to retain only polygons from one
> coverage that intersect points in another coverage? I think that's a
> semi-join.
> 
> Roughly: 'select a.* from polys a, points b where st_intersects(a.geom,
> b.geom)'

a[b,]

# or

st_join(a, b, left = FALSE) # no left join gives you inner join

> 
> Thanks.
> 
> THK
> 

-- 
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2472 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20190507/06a9be22/attachment.bin>