Re: [R] RGDAL OGRwrite question

2012-08-17 Thread Scott Duke-Sylvester
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  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" 
> 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 : smd3...@louisiana.edu
>>
>>
>>This e-mail message (including any attachments) is for t...{{dropped:11}}
>>
>>__
>>R-help@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 : smd3...@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).

__
R-help@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.


[R] RGDAL OGRwrite question

2012-08-17 Thread Scott Duke-Sylvester
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 : smd3...@louisiana.edu


This e-mail message (including any attachments) is for t...{{dropped:11}}

__
R-help@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.


[R] Using GIS data in R

2010-04-01 Thread Scott Duke-Sylvester
I have a simple problem: I need to load a ERSI shapefile of US states
and check whether or not a set of points are within the boundary of
these states. I have the shapefile, I have the coordinates but I'm
having a great deal of difficulty bringing the two together. The
problem is the various GIS packages for R do not play well with each
other. sp, shapefiles, maptools, etc all use different data
structures. Can someone suggest a simple set of commands that will
work together that will:

1) load the shapefile data.
2) Allow me to test whether or not a (lng,lat) coordinate pair are
inside or outside the polygons defined in the shapefile.

Many thanks,
scott.

-- 
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 : smd3...@louisiana.edu

__
R-help@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.