[R-sig-Geo] converting from NAD83 datum to lat,lon

Migun Shakya microbeatic at gmail.com
Tue Feb 26 03:14:30 CET 2013


Hi Mike,

I tried the rgdal:readOGR, but got an error.

> nc.river<-readOGR("~/hydromaj/hydromaj_arc.shp")
Error in readOGR("~/hydromaj/hydromaj_arc.shp") :
  missing layer

Sorry, I am not very familiar with the data structure, but i am
looking at the spatialreference.org. Lets see what i get.

Thanks,
Migun

Here is the .prj file content for hydromaj_arc.prj

PROJCS["NAD_1983_StatePlane_North_Carolina_FIPS_3200",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",609601.22],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-79.0],PARAMETER["Standard_Parallel_1",34.33333333333334],PARAMETER["Standard_Parallel_2",36.16666666666666],PARAMETER["Latitude_Of_Origin",33.75],UNIT["Meter",1.0]]

On Mon, Feb 25, 2013 at 9:01 PM, Michael Sumner <mdsumner at gmail.com> wrote:
> You need an input projection on the data, it doesn't know what you are
> transforming FROM.
>
> Did you read this with maptools::readShapePoly? Try with rgdal:readOGR
> so you get the projection automatically with the object.
>
> I cannot download the data from the link you provide, but if you post
> the text of the .prj files here someone will be able to give you R
> code to set it without re-reading.  (Explore for yourself on
> spatialreference.org).
>
> Also, "lat,lon" requires a datum like any map projection - you'll need
> to find out if you should stay with NAD83 or convert to WGS84 as in
> Erin's code.
>
> Cheers, Mike.
>
>
>
> On Tue, Feb 26, 2013 at 12:45 PM, Migun Shakya <microbeatic at gmail.com> wrote:
>> Hi Erin,
>> I tried that but ended up getting this error. Does the spTransform
>> function requires the data to be as data.frame?
>> Here is what i did to read the data
>>
>> library(maptools)
>> library(rgdal)
>> nc.river<-readShapeSpatial("~/hydromaj/hydromaj_arc.shp") #reading the
>> shape file
>>
>> nc1.wgs84 <- spTransform(nc.river,CRS("+proj=longlat +datum=WGS84"))
>> Error in spTransform(xSP, CRSobj, ...) :
>>   No transformation possible from NA reference system
>>
>>
>> Thanks again
>> Migee
>>
>> On Mon, Feb 25, 2013 at 5:47 PM, Hodgess, Erin <HodgessE at uhd.edu> wrote:
>>> Hi!
>>>
>>> Suppose your data set is called nc1.df.
>>>
>>> Then you can do:
>>> library(rgdal)
>>> nc1.wgs84 <- spTransform(nc1.df,CRS("+proj=longlat +datum=WGS84"))
>>>
>>>
>>> ________________________________________
>>> From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Migun Shakya [microbeatic at gmail.com]
>>> Sent: Monday, February 25, 2013 4:21 PM
>>> To: r-sig-geo at r-project.org
>>> Subject: [R-sig-Geo] converting from NAD83 datum to lat,lon
>>>
>>> Hi all,
>>>
>>> Is there a way/package/trick to convert the NAD83 formatted file to
>>> lat lon format?
>>>
>>> I downloaded the "Major Hydrography" dataset from NC,USA to plot
>>> rivers into a NC map. However, the dataset is in NAD83 or in state
>>> plane projection, but i need it to be in lat/lon.
>>>
>>>
>>> Any help would be great.
>>>
>>>
>>> Thanks
>>> Migee
>>>
>>>
>>> dataset can be found in:
>>> http://data.nconemap.com/geoportal/catalog/search/resource/details.page?uuid=%7B2515713B-2CA0-476F-863F-61441A9D6F70%7D
>>>
>>>
>>> The downloaded dataset consist of
>>> hydromaj_arc.dbf
>>> hydromaj_arc.prj
>>> hydromaj_arc.shp
>>> hydromaj_arc.shx
>>> hydromaj_arc.txt
>>> hydromaj_poly.dbf
>>> hydromaj_poly.prj
>>> hydromaj_poly.shp
>>> hydromaj_poly.shx
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>
> --
> Michael Sumner
> Hobart, Australia
> e-mail: mdsumner at gmail.com



More information about the R-sig-Geo mailing list