[R] trouble using readOGR() function
roger.bivand at nhh.no
Wed Apr 2 12:48:34 CEST 2014
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
> 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,
> Someone would have any idea to solve the "incompatible geometry" error ?
> Thanks for help!
More information about the R-help