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

Michael Sumner mdsumner at gmail.com
Tue Feb 26 03:01:45 CET 2013


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