[R] trouble using readOGR() function

Roger Bivand roger.bivand at nhh.no
Thu Apr 3 13:45:15 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
> 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!
>




More information about the R-help mailing list