[R-sig-Geo] Problem to Save a SpatialPolygonsDataFrame in a shape-file (GDAL Error 1: Invalid index : -1)

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Aug 31 21:10:33 CEST 2010


You're hiding some context in which this happens, I can't see whether it
is i that is -1 or something else. Please try to reproduce the error
message with a fixed file name, or even better in some way someone else
can reproduce it.

On 08/31/2010 08:55 PM, gianni lavaredo wrote:
> Dear reseearchers,
> 
> I have a problem to save a SpatialPolygonsDataFrame in a shape file
> my SpatialPolygonsDataFrame = sub.area.SPDF
> 
> thanks in Advance
> Gianni
> 
>> writeOGR(sub.area.SPDF,".", paste("Sub_Area",rand.patch[[i]],sep=""),
> driver="ESRI Shapefile")
> Error in writeOGR(sub.area.SPDF, ".", paste("Sub_Area", rand.patch[[i]],  :
> 
>         GDAL Error 1: Invalid index : -1
> In addition: Warning message:
> In writeOGR(sub.area.SPDF, ".", paste("Sub_Area", rand.patch[[i]],  :
>         Non-fatal GDAL Error 6: Normalized/laundered field name:
> 'rep.0..length.IDs..' to 'rep.0..len'
> 
> 
> # Attribute
> 
>> class(sub.area.SPDF)
> [1] "SpatialPolygonsDataFrame"
> attr(,"package")
> [1] "sp"
>> str(sub.area.SPDF)
> Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
>   ..@ data       :'data.frame': 1 obs. of  1 variable:
>   .. ..$ rep.0..length.IDs..: num 0
>   ..@ polygons   :List of 1
>   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
>   .. .. .. ..@ Polygons :List of 1
>   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
>   .. .. .. .. .. .. ..@ labpt  : num [1:2] 1669500 7112500
>   .. .. .. .. .. .. ..@ area   : num 40000
>   .. .. .. .. .. .. ..@ hole   : logi FALSE
>   .. .. .. .. .. .. ..@ ringDir: int 1
>   .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] 1669400 1669400 1669600
> 1669600 1669400 ...
>   .. .. .. ..@ plotOrder: int 1
>   .. .. .. ..@ labpt    : num [1:2] 1669500 7112500
>   .. .. .. ..@ ID       : chr "1"
>   .. .. .. ..@ area     : num 40000
>   ..@ plotOrder  : int 1
>   ..@ bbox       : num [1:2, 1:2] 1669400 7112400 1669600 7112600
>   .. ..- attr(*, "dimnames")=List of 2
>   .. .. ..$ : chr [1:2] "x" "y"
>   .. .. ..$ : chr [1:2] "min" "max"
>   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
>   .. .. ..@ projargs: chr NA
>>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>> sub.area.SPDF
> An object of class "SpatialPolygonsDataFrame"
> Slot "data":
>   rep.0..length.IDs..
> 1                   0
> 
> Slot "polygons":
> [[1]]
> An object of class "Polygons"
> Slot "Polygons":
> [[1]]
> An object of class "Polygon"
> Slot "labpt":
> [1] 1669500 7112500
> 
> Slot "area":
> [1] 40000
> 
> Slot "hole":
> [1] FALSE
> 
> Slot "ringDir":
> [1] 1
> 
> Slot "coords":
>         [,1]    [,2]
> [1,] 1669400 7112400
> [2,] 1669400 7112600
> [3,] 1669600 7112600
> [4,] 1669600 7112400
> [5,] 1669400 7112400
> 
> 
> 
> Slot "plotOrder":
> [1] 1
> 
> Slot "labpt":
> [1] 1669500 7112500
> 
> Slot "ID":
> [1] "1"
> 
> Slot "area":
> [1] 40000
> 
> 
> 
> Slot "plotOrder":
> [1] 1
> 
> Slot "bbox":
>       min     max
> x 1669400 1669600
> y 7112400 7112600
> 
> Slot "proj4string":
> CRS arguments: NA
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list