Hi Joana,
Try to modify your code as shown below and re run the script.

#project using sp transform:
UTM <- spTransform(LatLong, CRS("+proj=utm +zone=29 +ellps=WGS84
+datum=WGS84"  +units=m +no_defs  +towgs84=0,0,0"))
Let me know if it works for you.

Moshood






On Mon, Jun 17, 2013 at 2:53 PM, Hodgess, Erin <HodgessE@uhd.edu> wrote:

> Hi Joana:
>
> You may want to check out this website:
> http://georepository.com/crs_32729/WGS-84-UTM-zone-29S.html
>
> I think that you're getting the false northing and easting.
>
> Thanks,
> Erin
>
>
> -----Original Message-----
> From: r-sig-geo-bounces@r-project.org [mailto:
> r-sig-geo-bounces@r-project.org] On Behalf Of Joana Ruela Boavida
> Sent: Monday, June 17, 2013 3:05 PM
> To: r-sig-geo@r-project.org
> Subject: [R-sig-Geo] Lat Long --> UTM again
>
> Hello,
>
> perhaps someone can help. i'm trying to convert coordinates from decimal
> degrees (WGS84) to UTM zone 29S (Portugal), but i have two problems:
>
> 1) i always get a wrong northing. I've read all messages regarding this
> subject and online documentation, which greatly helped, but i still
> couldn't get the correct northing. This is the code i used:
>
> #csv file with raw data
> frames<-read.table("framescoords.csv", sep=";", header=T) dd <-
> cbind(frames$long, frames$lat) LatLong <- data.frame(X = dd[,1], Y =
> dd[,2]) #X is longitude
>
> #convert to sp object:
> coordinates(LatLong) <- ~ Y + X #longitude first
>
> #adding a coordinate reference system:
> proj4string(LatLong) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
> LatLong
>
> #project using sp transform:
> UTM <- spTransform(LatLong, CRS("+proj=utm +zone=29 +north +ellps=WGS84
> +datum=WGS84"))
> UTM
>
> e.g. for the coordinates pair (dd): 36,9892160333 and -8,4846898591 i get:
>
> SpatialPoints:
>           Y        X
>  [1,] 5e+05 -9997965
> (...)
> Coordinate Reference System (CRS) arguments: +proj=utm +zone=29
> +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0
>
> i believe i should be getting: 545 856.274 and  4 093 809.460 Meters
>
> i also tried:
> proj4string(LatLong) <- CRS("+init=epsg:32629") UTM <-
> spTransform(LatLong, CRS("+init=epsg:32629")) UTM
>
> and got:
>
> SpatialPoints:
>              Y         X
>  [1,] 36.98933 -8.484690
>  [2,] 36.98926 -8.484682
>  [3,] 36.98921 -8.484672
> etc...
> Coordinate Reference System (CRS) arguments: +init=epsg:32629 +proj=utm
> +zone=29 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +towgs84=0,0,0
>
> so, no transformation.
>
> 2) Another problem is that regardless the values being correct or not, i
> get the same value for all points (in fact they are very close to each
> other but i need to get a distance matrix in meters, so i really need this
> to be accurate):
>
> SpatialPoints:
>           Y        X
>  [1,] 5e+05 -9997965
>  [2,] 5e+05 -9997965
>  [3,] 5e+05 -9997965
>  [4,] 5e+05 -9997965
>  [5,] 5e+05 -9997965
> (etc...)
>
> Finally, it is not feasible to do it using an online conversion tool since
> i need to repeat this for many coordinates and for many different sites,
> and the few that i've tried give always the same coordinates, ie, don't
> have enough resolution for close points(?).
>
> Any comments may be helpful. Thank you very much, joanna
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]

