[R] RGDAL OGRwrite question

Scott Duke-Sylvester scottdukesylvester at gmail.com
Fri Aug 17 21:23:30 CEST 2012


In the example I gave, the "temp.shp", 'temp.bdf", etc ... do not
exist in the current working directory (".") before I call:
writeOGR(shape, '.', layer='temp', driver='ESRI Shapefile', verbose=TRUE)

I should have specified this. Also, the working directory permissions
are set to owner read/write/execute (unix: drwxr-xr-x).



On Fri, Aug 17, 2012 at 2:17 PM, MacQueen, Don <macqueen1 at llnl.gov> wrote:
> 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.
>



-- 
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 the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).




More information about the R-help mailing list