Hello, I've been trying every now and then to find a cross operating system solution that would let me access PostgreSQL (and PostGIS) from R, or to access R from PostgreSQL. I know of pl/r, which accomplishes the latter, but has yet to be successfully ported to Windows. Similarly, I've tried to use Rdbi and DBI, but I haven't had luck with those on Windows either for connecting to PostgreSQL from R. Can anyone suggest a solution for this? It would seem that rgdal could also help me in this case. Unfortunately, the version of the GDAL library that is included in the rdgal binary available on CRAN (for windows) doesn't include the PostgreSQL driver for OGR (i.e., it's not listed by the ogrDrivers() function). I compiled rgdal on Windows myself using the GDAL library from FWTools-1.3.1, but I was unsuccessful at creating a proper binary package for R. I was only able to get it to work by substituting the rgdal.dll that was installed by CRAN with the one that I compiled that links against the GDAL library from FWTools. Even though it works (at first glance with ogrInfo(), and readOGR()), I still get a warning message when I load the libary: "DLL attempted to change FPU control word from 8001f to 9001f". So my question with respect to rgdal is a) is it likely that an rgdal package is going to be released in the future with the PostgreSQL driver included in GDAL/OGR, or b) are there any suggestions/instructions that might get me through the compilation and packaging process for rgdal with better success? Thanks in advance for any help, Mike
Roger Bivand
2007-May-30 21:00 UTC
[R] [R-sig-Geo] Connecting to PostgreSQL/PostGIS from R (rgdal?)
On Wed, 30 May 2007, Mike Leahy wrote:> Hello, > > I've been trying every now and then to find a cross operating system > solution that would let me access PostgreSQL (and PostGIS) from R, or to > access R from PostgreSQL. I know of pl/r, which accomplishes the > latter, but has yet to be successfully ported to Windows. Similarly, > I've tried to use Rdbi and DBI, but I haven't had luck with those on > Windows either for connecting to PostgreSQL from R. Can anyone suggest > a solution for this? > > It would seem that rgdal could also help me in this case. Unfortunately, > the version of the GDAL library that is included in the rdgal binary > available on CRAN (for windows) doesn't include the PostgreSQL driver > for OGR (i.e., it's not listed by the ogrDrivers() function). > > I compiled rgdal on Windows myself using the GDAL library from > FWTools-1.3.1, but I was unsuccessful at creating a proper binary > package for R. I was only able to get it to work by substituting the > rgdal.dll that was installed by CRAN with the one that I compiled that > links against the GDAL library from FWTools. Even though it works (at > first glance with ogrInfo(), and readOGR()), I still get a warning > message when I load the libary: "DLL attempted to change FPU control > word from 8001f to 9001f". > > So my question with respect to rgdal is a) is it likely that an rgdal > package is going to be released in the future with the PostgreSQL driver > included in GDAL/OGR, or b) are there any suggestions/instructions that > might get me through the compilation and packaging process for rgdal > with better success?The warning is harmless - R is just reporting that it has stopped the dynamically linked libraries resetting a flag that they should not change while R is running. If you followed the notes in README.windows in rgdal, you ought to be OK. There are no plans to provide more Windows binary drivers than those present now, because the others involve further external dependencies, which most users would not welcome. So please try to do an ogrinfo at the command line in Windows using FWTools to your PostGIS data, and then the equivalent within R with your locally built rgdal, and see how it goes. Even on Linux, getting all the components lined up isn't easy, according to people who have tried, but can be done if you need to do it. Hope this helps, Roger> > Thanks in advance for any help, > Mike > > _______________________________________________ > 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
Tim Keitt
2007-May-30 21:31 UTC
[R] [R-sig-Geo] Connecting to PostgreSQL/PostGIS from R (rgdal?)
I would also recommend you take a look at RODBC for general purpose database access. My impression is that it has received a lot more maintenance attention lately. I can't comment on the windows gdal binaries as I'm not too familiar with that platform. THK On 5/30/07, Mike Leahy <mgleahy at alumni.uwaterloo.ca> wrote:> Hello, > > I've been trying every now and then to find a cross operating system > solution that would let me access PostgreSQL (and PostGIS) from R, or to > access R from PostgreSQL. I know of pl/r, which accomplishes the > latter, but has yet to be successfully ported to Windows. Similarly, > I've tried to use Rdbi and DBI, but I haven't had luck with those on > Windows either for connecting to PostgreSQL from R. Can anyone suggest > a solution for this? > > It would seem that rgdal could also help me in this case. Unfortunately, > the version of the GDAL library that is included in the rdgal binary > available on CRAN (for windows) doesn't include the PostgreSQL driver > for OGR (i.e., it's not listed by the ogrDrivers() function). > > I compiled rgdal on Windows myself using the GDAL library from > FWTools-1.3.1, but I was unsuccessful at creating a proper binary > package for R. I was only able to get it to work by substituting the > rgdal.dll that was installed by CRAN with the one that I compiled that > links against the GDAL library from FWTools. Even though it works (at > first glance with ogrInfo(), and readOGR()), I still get a warning > message when I load the libary: "DLL attempted to change FPU control > word from 8001f to 9001f". > > So my question with respect to rgdal is a) is it likely that an rgdal > package is going to be released in the future with the PostgreSQL driver > included in GDAL/OGR, or b) are there any suggestions/instructions that > might get me through the compilation and packaging process for rgdal > with better success? > > Thanks in advance for any help, > Mike > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-geo >-- Timothy H. Keitt, University of Texas at Austin Contact info and schedule at http://www.keittlab.org/tkeitt/ Reprints at http://www.keittlab.org/tkeitt/papers/ ODF attachment? See http://www.openoffice.org/
I truly apologize, I just found the clines package. Thanks. Andrew Niccolai Doctoral Candidate Yale School of Forestry
You can now use contourLines in the grDevices package included with R. Hadley On 5/31/07, Andrew Niccolai <andrew.niccolai at yale.edu> wrote:> I truly apologize, I just found the clines package. Thanks. > > > Andrew Niccolai > Doctoral Candidate > Yale School of Forestry > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-geo >