Search code examples
versionshapesrasterqgis

trouble reading shape file from QGIS 2.6


I would like to read a shape file created/saved by QGIS into R using the raster package. It was working just fine until I updated QGIS to version 2.6.

For camparison I used a (point) shape file unaltered by QGIS and saved a selection of points to a new file, a) using QGIS 2.4 and b) using QGIS 2.6.

The result is, the file created by QGIS 2.4 reads fine into R and the other one created by QGIS version 2.6 does not.

Error message (in german, sorry):

shape <- shapefile(file.choose()) Fehler in readOGR(dirname(x), fn, stringsAsFactors = stringsAsFactors, : Incompatible geometry: 4 Zusätzlich: Es gab 50 oder mehr Warnungen (Anzeige der ersten 50 mit warnings())

Has anyone stumbled across this issue?

cheers Moe


Solution

  • i think your answer is here: https://gis.stackexchange.com/questions/78618/loading-a-multipoint-shapefile-in-r

    It's a fact, that readOGR does not handle multipoints (for whatever reasons). You may insist on your file not being multipoint, but that doesn't help, cause readOGR identifies it as such ("Incompatible geometry: 4"). 4 is the index number for multipoint in OGR.

    It is also mentioned that ArcGIS seems to produce sometimes such point layers with parts that are identified by OGR as multipoint. The same applies to some functions in QGIS 2.6 (e.g. I created a point grid (-> point) and intersected it with a polygon ( -> multipoint).

    The only way to get rid of the "multipoint" was to use "multipart to singlepart" in QGIS.

    Maptools readShapePoints does not seem to have this flaw, so I normally use this to load point data to avoid trouble.

    Maybe the QGIS-bug will be solved with 2.6.1, otherwise wait for 2.8 or use "multipart to singlepart" in the meantime.