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]]

