The first one is easy, probably raster data, not vector and is named
"RadarDat" not "RasterDat":

> myprj<-readOGR(dsn="c:/temp/",layer="RasterDat")

library(rgdal)
myraster <- readGDAL("c:/temp/RadarDat.asc")

For this one, you don't need system.file()

> myprj<-readShapeSpatial(system.file("c:/temp/Dummy_ShpFile.shp"))

But you seem to know that already since you use this:

> getinfo.shape("c:/temp/Dummy_ShpFile.shp")

So

myprj<-readShapeSpatial("c:/temp/Dummy_ShpFile.shp")

Finally, not sure case matters, but it's what I would try first, to at least
be consistent with your other code:

> myprj<-readOGR(dsn="c:/temp/",layer="dummy_ShpFile")


myprj<-readOGR(dsn="c:/temp/",layer="Dummy_ShpFile")

Cheers, Mike.

On Fri, Apr 29, 2011 at 1:12 PM, emorway <emorway@usgs.gov> wrote:

> Hello,
>
> Having searched around on some related posts I have yet to figure this one
> out.  While trying to grab the spatial information of a raster I turned to
> the readOGR function.
>
> myprj<-readOGR(dsn="c:/temp/",layer="RasterDat")
>
> but got an error:
>
> #Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
> #  Cannot open file
>
> Next, I used ArcCatalog to create an empty shapefile and imported the
> spatial information from the raster to the shapefile and tried using
> readOGR
> and readShapeSpatial on it (in case there was some issue with the raster):
>
> myprj<-readOGR(dsn="c:/temp/",layer="dummy_ShpFile")
> #Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
> #  Cannot open file
> myprj<-readShapeSpatial(system.file("c:/temp/Dummy_ShpFile.shp"))
> #Error in getinfo.shape(fn) : Error opening SHP file
>
> but I know the file is there using this command:
>
> getinfo.shape("c:/temp/Dummy_ShpFile.shp")
> #Shapefile type: PolyLine, (3), # of Shapes: 0
>
> I have attached the 3 files associated with the raster and put the contents
> of the *.prj here:
>
>
> PROJCS["User_Defined_Stereographic_North_Pole",GEOGCS["GCS_User_Defined",DATUM["D_User_Defined",SPHEROID["User_Defined_Spheroid",6371200.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Stereographic_North_Pole"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-105.0],PARAMETER["Standard_Parallel_1",60.0],UNIT["Meter",1.0]]
>
> http://r-sig-geo.2731867.n2.nabble.com/file/n6315537/RadarDat.asc
> RadarDat.asc
> http://r-sig-geo.2731867.n2.nabble.com/file/n6315537/RadarDat.prj
> RadarDat.prj
> http://r-sig-geo.2731867.n2.nabble.com/file/n6315537/RadarDat.asc.xml
> RadarDat.asc.xml
>
> The post that looked most relevant appears to have had a bit of private
> back
> and forth and so the final solution wasn't available:
>
> http://r.789695.n4.nabble.com/Problem-with-uploading-library-td3170455.html#a3170670
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/read-projection-file-throws-error-tp6315537p6315537.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner@gmail.com

	[[alternative HTML version deleted]]

