[R-sig-Geo] reading a feature class

Michael Sumner mdsumner at gmail.com
Wed Jul 9 12:59:42 CEST 2014


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> 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
>
> Mail: jbechara at lri-lb.org <jbejjani at lri-lb.org>
>
> www.lri-lb.org
>
> [image: Description: Description: LRI-logo-Email]
>
>
>
> *From:* Michael Sumner [mailto:mdsumner at gmail.com]
> *Sent:* Wednesday, July 09, 2014 12:34 PM
> *To:* Joseph Bechara
> *Cc:* RsigGeo; Frede Aakmann Tøgersen
> *Subject:* Re: [R-sig-Geo] reading a feature class
>
>
>
> Try
>
> ogrListLayers( dsn="C:/sophie/Allpoints/All_poly.gdb")
>
> that should give you the right layer name/s for use with readOGR
>
> On 9 Jul 2014 16:59, "JOSEPH BECHARA" <jbechara at lri-lb.org> wrote:
>
> Dear Frede,
>
>
>
> Thanks for your reply.
>
>
>
> This is the function that is not working
>
> bb<-readOGR(dsn="C:/sophie/Allpoints/All_poly.gdb",layer="All_lays1")
>
>
>
> All lays is a feature class in a file gdb(new) .
>
> The file is not corrupted I’m able to open it on ARCIS and I’m doing the
> zonal statisctics there.
>
> I opened the rgdal library and I’m using R studio
>
> Rgdal version 0.8-16
>
>
>
> *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 <jbejjani at lri-lb.org>
>
> www.lri-lb.org
>
> [image: Description: Description: LRI-logo-Email]
>
>
>
> *From:* Frede Aakmann Tøgersen [mailto:frtog at vestas.com]
> *Sent:* Tuesday, July 08, 2014 6:13 PM
> *To:* JOSEPH BECHARA; r-sig-geo at r-project.org
> *Subject:* RE: [R-sig-Geo] reading a feature class
>
>
>
> Hi
>
>
>
> I don't know the gdb file format. Is it in raster or vector format?
>
>
>
> Since you used readOGR you probably did have a look at
>
>
>
> http://www.gdal.org/ogr_formats.html
>
>
>
> before asking.
>
>
>
> So there, two ESRI formats are mentioned: personal gdb (old) and file gdb
> (new?).
>
>
>
> Do you what kind of gdb file you have?
>
>
>
> Why you can't read the file could be because of several problems.
>
>
>
> Is the file corrupted?
>
>
>
> What is your OS?
>
>
>
> What version of R/rgdal?
>
>
>
> Does the OS/R/rgdal combination involves formats for either pgdb or
> filegdb?
>
>
>
> Nobody can help you with that little information you have given us.
>
>
>
> Br.
>
>
>
> Frede
>
>
>
>
>
> Sendt fra Samsung mobil
>
>
>
> -------- Oprindelig meddelelse --------
> Fra: JOSEPH BECHARA
> Dato:08/07/2014 16.35 (GMT+01:00)
> Til: r-sig-geo at r-project.org
> Emne: [R-sig-Geo] reading a feature class
>
> Dear All,
>
>
>
> I ‘m trying ti import a feature class from a gdb to R using readOGR.
>
> Unfortunately it is not working.
>
> Anybody has a suggestion of a function to read it.
>
>
>
>
>
> *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 <jbejjani at lri-lb.org>
>
> www.lri-lb.org
>
> [image: Description: Description: LRI-logo-Email]
>
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140709/e85334fd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 16370 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140709/e85334fd/attachment.jpg>


More information about the R-sig-Geo mailing list