Hi Romina,
looking at { http://spatialreference.org/ref/epsg/32721/ } I can see the
UTM zone 21H or also 21S for South spans longitudes in the range (-80,-60)
so I guess you just inverted easting and northing in your code:

So:
  $ LatLong <- data.frame(Y=-35.14189, X=-57.39206)  # <--  X is the
LONGITUDE.
  $ coordinates(LatLong) <- ~ X+Y
  $ proj4string(LatLong) <- CRS("+init=epsg:4326")
  $ Utm <- spTransform(LatLong, CRS("+init=epsg:32721"))
  $ Utm

    SpatialPoints:
                X       Y
    [1,] 464285.6 6111151

Cheers,
Piero




In general anyway, it's safer to identify CRS by EPSG code -- which in your
case is 32721 (http://spatialreference.org/ref/epsg/32721/) --, then you
can create it like this:

    $ Utm <- spTransform(LatLong, CRS("+init=epsg:32721"))



On 6 June 2012 17:57, <rscardamag...@ege.fcen.uba.ar> wrote:

> Hello,
> I need some help transforming Latitude Longitude coordinates (in decimal
> degrees) to UTM (zone 21 H, since I’m in Buenos Aires, Argentina).
> This is the script I used. The transformation for the easting coordinates
> is correct but not for the Northing.
>
> > LatLong <- data.frame(X = coordenadas2[,1], Y = coordenadas2[,2])
> > LatLong
>          X         Y
> 1 -35.14189 -57.39206
> 2 -35.14072 -57.39421
> 3 -35.14507 -57.38274
> 4 -35.14390 -57.39083
> 5 -35.14496 -57.39312
> 6 -35.14069 -57.39280
> 7 -35.14241 -57.39119
>
> > coordinates(LatLong) <- ~ Y + X
> > proj4string(LatLong) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
> > Utm <- spTransform(LatLong, CRS("+proj=utm +zone=21 ellps=WGS84"))
> > Utm
>
> SpatialPoints:
>            Y        X
> [1,] 464285.6 -3888849
> [2,] 464089.3 -3888720
> [3,] 465136.0 -3889198
> [4,] 464398.6 -3889071
> [5,] 464190.4 -3889189
> [6,] 464217.7 -3888716
> [7,] 464365.1 -3888906
>
> Coordinate Reference System (CRS) arguments: +proj=utm +zone=21
> +ellps=WGS84
>
> It seems the Easting coordinates are well transformed, but the Northing
> should be around 6111151.35 m S (for the first one for example).
> I would really appreciate some help.
> Best wishes,
>
> Romina.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to