[R-sig-Geo] reading a feature class

Frede Aakmann Tøgersen frtog at vestas.com
Thu Jul 10 08:04:22 CEST 2014


Hi Michael

Thanks for the information about gdal drivers. The version I had on my windows box was:

rgdal: version: 0.8-16, (SVN revision 498)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26

Which did not have the GDB driver. An update.packages(oldPkgs = "rgdal") didn't give me the GDAL 1.11.0 version. I had to remove.packages("rgdal") and then install.packages("rgdal").

Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 

From: Michael Sumner [mailto:mdsumner at gmail.com] 
Sent: 10. juli 2014 02:17
To: Roger Bivand
Cc: Joseph Bechara; Frede Aakmann Tøgersen; RsigGeo
Subject: Re: [R-sig-Geo] reading a feature class

On 10 Jul 2014 03:24, "Roger Bivand" <Roger.Bivand at nhh.no> wrote:
The reason is that Joseph Bechara's post included a jpeg image at 16KB, and an HTML component breaking the list requirement to post in plain text only. Multiple copies of his logo then clog up the system.

The real answer to is problem is that ogrDrivers() will show that he does not have the driver (certainly not in the CRAN binaries). GDB is a proprietary format that can be used if you builds GDAL/OGR against ESRI binaries, not otherwise (certainly for Personal GDB, and effectively for File GDB). The data must be saved from ArcGIS in an open format.

Hope this clarifies,

Roger

 
GDB has been reverse engineered and is included in the Windows binary on CRAN, as well as by default in source installs. 
http://erouault.blogspot.com.au/2013/10/filegdb-format-reverse-engineered.html
http://www.gdal.org/drv_openfilegdb.html
(Unless I'm still missing something). 
Platform: x86_64-w64-mingw32/x64 (64-bit)
...
> library(rgdal)
Loading required package: sp
rgdal: version: 0.8-16, (SVN revision 498)
...Loaded GDAL runtime: GDAL 1.11.0, released 2014/04/16
...GDAL does not use iconv for recoding strings.
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
library(rgdal)
subset(ogrDrivers(), grepl("GDB", name))
          name write
29 OpenFileGDB FALSE

ogrListLayers("/path/to/folderworld.gdb")
[1] "cities"             "latitude_longitude" "countries"         
[4] "continents"   

Cheers, Mike. 



On Wed, 9 Jul 2014, Frede Aakmann Tøgersen wrote:

From: Frede Aakmann T??gersen
Sent: 9. juli 2014 15:12
To: 'JOSEPH BECHARA'; 'Michael Sumner'
Cc: 'RsigGeo'
Subject: FW: [R-sig-Geo] reading a feature class

Hi I am getting some information like this from the list:


Your mail to 'R-sig-Geo' with the subject



   RE: [R-sig-Geo] reading a feature class



Is being held until the list moderator can review it for approval.



The reason it is being held:



   Message body is too big: 76484 bytes with a limit of 50 KB



Either the message will get posted to the list, or you will receive

notification of the moderator's decision.  If you would like to cancel

this posting, please visit the following URL:



   https://stat.ethz.ch/mailman/confirm/r-sig-geo/5859051c379864eae2b43f7c1fcf9c94159715a0

Cutting and resending:


Hi

Well both Michael and I are just guessing because of lack of information. I cannot really help you before I can try to read your file on my system (both windows and linux) before I can be of any use to help you. I suppose that Michael expressed the same.

One thing that comes to my mind is that reading vector formats into R requires lots of physical memory. If your computer do not have that it is probably swapping to hard disk (hence working along for ever). Can you check that? If so you might as well kill the process and think on other approaches.

Yes, other software may handle this more efficient than R.

Yours sincerely / Med venlig hilsen


Frede Aakmann T??gersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com<mailto:frtog at vestas.com>
http://www.vestas.com<http://www.vestas.com/>

Company reg. name: Vestas Wind Systems A/Sas well
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice<http://www.vestas.com/legal/notice>
If you have received this e-mail in error please contact the sender.

From: JOSEPH BECHARA [mailto:jbechara at lri-lb.org]
Sent: 9. juli 2014 14:44
To: 'Michael Sumner'
Cc: Frede Aakmann T??gersen; 'RsigGeo'
Subject: RE: [R-sig-Geo] reading a feature class

I tried your suggestion and it is working.  I got the below message but it have been running for almost 1 h and didn???t close the ring yet.




bb<-readOGR(dsn="All_poly.gdb",layer="All_lays1")
OGR data source with driver: OpenFileGDB
Source: "All_poly.gdb", layer: "All_lays1"
with 9067252 features and 5 fields
Feature type: wkbMultiPolygon with 2 dimensions


JOSEPH BECHARA
Wildfire Management Component Coordinator
Ashrafieh 1020 Building, 8th floor, Mathaf, Beirut, Lebanon
Tel.: +961 (1) 426630-1-2
Fax: +961 (1) 426631
Mail: jbechara at lri-lb.org<mailto:jbejjani at lri-lb.org>
www.lri-lb.org<http://www.lri-lb.org/>


From: Michael Sumner [mailto:mdsumner at gmail.com]
Sent: Wednesday, July 09, 2014 2:00 PM
To: Joseph Bechara
Cc: Frede Aakmann T??gersen; RsigGeo
Subject: RE: [R-sig-Geo] reading a feature class


dd is the layer name/s, so literally I meant to use it to find what "All_lays1" really should be. (I have no experience with this format thankfully).

So see for yourself what ogrListLayers reports, then the dsn for readOGR is the same, but it also wants a layer name as the second arg.

(I probably need to find one of these "geodatabases" things and try for myself before I can help.)

dsn is the data source (the mothership)

layer is the one or more layer-thingys in that ship

(shapefiles have just one layer, hence the most available example breaks the more general mould)

Clear? See ?readOGR for examples
On 9 Jul 2014 19:59, "JOSEPH BECHARA" <jbechara at lri-lb.org<mailto:jbechara at lri-lb.org>> wrote:
Hi Michael,

It worked partially.
I still have an error message
dd<-ogrListLayers(dsn="C:/sophie/Allpoints/All_poly.gdb")
bb<-readOGR(dsn=dd,layer="All_lays1")
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv) :
 Cannot open file
In addition: Warning messages:
1: In if (nchar(dsn) == 0) stop("empty name") :
 the condition has length > 1 and only the first element will be used
2: In if (nchar(dsn) == 0) stop("empty name") :
 the condition has length > 1 and only the first element will be used


JOSEPH BECHARA
Wildfire Management Component Coordinator
Ashrafieh 1020 Building, 8th floor, Mathaf, Beirut, Lebanon
Tel.: +961 (1) 426630-1-2
Fax: +961 (1) 426631<tel:%2B961%20%281%29%20426631>
Mail: jbechara at lri-lb.org<mailto:jbejjani at lri-lb.org>
www.lri-lb.org<http://www.lri-lb.org/>



        [[alternative HTML version deleted]]

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list