Hi all, I got some trouble trying to open a .kml file into R. Usually, the readOGR package works great for it but here I get a message error that I can't understand. When I'm typing this : myfile <-readOGR(dsn="/windows/landuse.kml",layer="agricultural use") I get the following error : Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv use_iconv) : Multiple incompatible geometries: 6:7 It seems that the file is read, since I get different parameters on it while using OGRSpatialRef() or ogrListLayers() Someone would have any idea to solve the "incompatible geometry" error ? Thanks for help! -- View this message in context: http://r.789695.n4.nabble.com/trouble-using-readOGR-function-tp4687937.html Sent from the R help mailing list archive at Nabble.com.
remissssss <rgenevest <at> free.fr> writes:> > Hi all, > I got some trouble trying to open a .kml file into R. Usually, the readOGR > package works great for it but here I get a message error that I can't > understand. > > When I'm typing this : > myfile <-readOGR(dsn="/windows/landuse.kml",layer="agricultural use") > > I get the following error : > Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv > use_iconv) : > Multiple incompatible geometries: 6:7 >Please consider using the R-sig-geo list, as this is a somewhat specialised question not of interest to most R-help subscribers. When posting questions, always report the output of sessionInfo(), so giving your platform information (here probably Windows?) and package versions. The problem is not that the file cannot be opened, but that it contains multiple incompatible geometries, as the error message says. If you file contains incompatible geometries, ones that cannot be read as points or lines or polygons, the data can be read, but cannot be imported into sp classes, which treat these geometry types separately. Here, type 6 is wkbMultiPolygon, while type 7 is wkbGeometryCollection, which is not acceptable under any circumstances. Consequently, the problem is in the software generating the file you are trying to read, or your expectation of being able to read a file into sp classes for which no provision is made. Most likely the upstream software is passing on a geometry problem it hasn't resolved itself. Hope this clarifies, Roger> > Someone would have any idea to solve the "incompatible geometry" error ? > > Thanks for help! >
remissssss <rgenevest <at> free.fr> writes:> > Hi all, > I got some trouble trying to open a .kml file into R. Usually, the readOGR > package works great for it but here I get a message error that I can't > understand. > > When I'm typing this : > myfile <-readOGR(dsn="/windows/landuse.kml",layer="agricultural use") > > I get the following error : > Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv > use_iconv) : > Multiple incompatible geometries: 6:7 >readOGR is a function in the rgdal package. This is a specialised question better asked on R-sig-geo. In addition, you have not provided the output of sessionInfo() so that we know your platform and package versions, nor the messages shown on the console when rgdal is loaded (versions of the external libraries being interfaced. The sp classes into which you are reading data can only hold points or lines or polygons separately. I have revised ogrInfo so that instead of 6:7 it will in the future show: MultiPolygon:GeometryCollection. A geometry collection is a catch-all that your data source (the provider of the KML file) hasn't managed to define in a simple way, and this is where you need to go to resolve the problem. Hope this clarifies, Roger> It seems that the file is read, since I get different parameters on it while > using OGRSpatialRef() or ogrListLayers() > > Someone would have any idea to solve the "incompatible geometry" error ? > > Thanks for help! >
On 1 Apr 2014 22:25, "remissssss" <rgenevest@free.fr> wrote:> > Hi all, > I got some trouble trying to open a .kml file into R. Usually, the readOGR > package works great for it but here I get a message error that I can't > understand. > > When I'm typing this : > myfile <-readOGR(dsn="/windows/landuse.kml",layer="agricultural use") > > I get the following error : > Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv > use_iconv) : > Multiple incompatible geometries: 6:7Maybe the file mixes topological types? Maybe contains any two of points lines polygons, or some other type not supported. Can you provide the file? Please use R-SigGeo for this topic rather than this one. Cheers, Mike> > It seems that the file is read, since I get different parameters on itwhile> using OGRSpatialRef() or ogrListLayers() > > Someone would have any idea to solve the "incompatible geometry" error ? > > Thanks for help! > > > > -- > View this message in context:http://r.789695.n4.nabble.com/trouble-using-readOGR-function-tp4687937.html> Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]