[R-sig-Geo] passing SQL through readOGR()
b.rowlingson at lancaster.ac.uk
Tue Oct 13 17:47:58 CEST 2009
On Tue, Oct 13, 2009 at 4:34 PM, Tom Gottfried <tom.gottfried at wzw.tum.de> wrote:
> Hi list,
> is there a way to pass any SQL-statement through readOGR (as with the -sql Option to ogr2ogr). I
> want to import a subset of a large dataset from PostGIS into R. I know it's possible with for
> example RODBC and then coercing the resulting data.frame to an sp-class, but I wonder if I can do it
> directly through readOGR().
If you cant get the sql into readOGR directly (and I anticipate a
post from Roger telling you how to do that to appear about three
seconds after I hit 'send') then you might be able to do it with the
OGR virtual driver:
There's an example there with some SQL embedded in the XML.
More information about the R-sig-Geo