Skip to content

RGDAL OGRwrite question

4 messages · Scott Duke-Sylvester, MacQueen, Don

#
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:
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
Error in writeOGR(shape, ".", layer = "temp", driver = "ESRI Shapefile") :
  Creation of output file failed
$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}}
#
Are the output files already there?
In that case, try overwrite_layer=TRUE

-Don
#
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:

  
    
3 days later
#
For what (little) it's worth, writeOGR() is working for me
  OS X 10.6.8
  rgdal_0.7-12
May be time to ask on r-sig-geo.
Same directory permissions

Simple somewhat diagnostic test would be to try writing somewhere else,
such as a subdirectory.

-Don