[R] RGDAL OGRwrite question

MacQueen, Don macqueen1 at llnl.gov
Fri Aug 17 21:17:16 CEST 2012


Are the output files already there?
In that case, try overwrite_layer=TRUE

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 8/17/12 9:28 AM, "Scott Duke-Sylvester" <scottdukesylvester at gmail.com>
wrote:

>I have a quick question: It appears that in rgdal v0.7-12 (R version
>2.15.1, OSX 10.6.8) writeOGR will not write a shapefile the the
>current directory. Is this correct? An earlier version of rgdal must
>have allowed this because I have a older script that used to work, but
>doesn't now.
>
>So, as an example, here is what I get today:
>
>> shape = readOGR('.', layer='S20_G75_V00_HAASHP10_R00')
>OGR data source with driver: ESRI Shapefile
>Source: ".", layer: "S20_G75_V00_HAASHP10_R00"
>with 169 features and 23 fields
>Feature type: wkbPolygon with 2 dimensions
>
>> writeOGR(shape, '.', layer='temp', driver='ESRI Shapefile',
>>verbose=TRUE)
>Error in writeOGR(shape, ".", layer = "temp", driver = "ESRI Shapefile") :
>  Creation of output file failed
>
>> writeOGR(shape, '/tmp', layer='temp', driver='ESRI
>>Shapefile',verbose=TRUE)
>$object_type
>[1] "SpatialPolygonsDataFrame"
>
>$output_dsn
>[1] "/tmp"
>
>$output_layer
>[1] "temp"
>
>$output_diver
>[1] "ESRI Shapefile"
>
>$output_n
>[1] 169
>
>$output_nfields
>[1] 23
>
>$output_fields
> [1] "ID"         "ANID"       "F_AREA"     "Avg_z"      "Manning"
> [6] "IniWL"      "IniSal"     "DispCoeff"  "HydRad"     "veg1_DW"
>[11] "veg2_IW"    "veg3_SW"    "veg4_DC"    "veg5_IC"    "veg6_SC"
>[16] "veg7_Marsh" "veg8_Swamp" "Rain_StID"  "Wetland"    "Openwater"
>[21] "iniBed_m"   "maxH_m"     "BoxID"
>
>$output_fclasses
> [1] 0 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 4
>
>$dataset_options
>NULL
>
>$layer_options
>NULL
>
>
>--
>Scott M. Duke-Sylvester
>Assistant Professor
>Department of Biology
>
>Office : 300 E. St. Mary Blvd
>             Billeaud Hall, Room 141
>             Lafayette, LA 70504
>
>Mailing address : UL Lafayette
>                  Department of Biology
>                  P.O.Box 42451
>                  Lafayette, LA 70504-2451
>
>Phone : 337 482 5304
>Fax   : 337 482 5834
>email : smd3729 at louisiana.edu
>
>
>This e-mail message (including any attachments) is for t...{{dropped:11}}
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list