[R-sig-Geo] readShapePoints issue
Roger Bivand
Roger.Bivand at nhh.no
Mon Sep 26 11:22:10 CEST 2011
On Mon, 26 Sep 2011, Raffaele Morelli wrote:
> Hi,
>
> I am working with R and using pgsql2shp to export shape files from pg. The
> shapes are created by pgsql2shp but when I try to import them in a R
> enviromnent I get this error
>
> Error in res[i, ] <- Map$Shapes[[i]]$verts : replacement has length zero
>
> So, I can load the shape files in Qgis but not in R. Moreover, if I load one of
> those files in Qgis and then export it again... this file is correctly
> loaded by R.
>
> I really can't guess what's wrong. Any idea?
Use readOGR() in rgdal, not readShapeSpatial() in maptools. You are also
generating objects with no coordinates, so the real issue is upstream, in
PostGIS or the intermediate utility. Why not build your own PostGIS driver
for OGR, and read directly with readOGR():
http://wiki.intamap.org/index.php/PostGIS
Hope this clarifies,
Roger
>
> Regards
> Raffaele
>
> --
> L'unica speranza di catarsi, ammesso che ne esista una, resta affidata
> all'istinto di ribellione, alla rivolta non isterilita in progetti,
> alla protesta violenta e viscerale.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list