# [Proj] Reversible Calculation? (cs2cs) <-- syntax mistake (-r)

oon at informatika.org oon at informatika.org
Wed Sep 13 01:53:57 EDT 2006

```I found the answer about my previous coordinate transformation not
reversible, because syntax mistake of cs2cs.
In the reverse calculation i shouldn't use -r

=====
minnie:~/proj4/bin oon\$ ./cs2cs -r +proj=latlong +datum=WGS84 +to
+proj=utm +datum=WGS84 +zone=47
3d30'17.47"N 98d36'27.58"E
456423.28       387405.51 0.00
25'32.12N 101d26'29.35"E
771751.63       47083.39 0.00
^C
minnie:~/proj4/bin oon\$ ./cs2cs +proj=utm +datum=WGS84 +zone=47 +to
+proj=latlong +datum=WGS84
456423.28       387405.51
98d36'27.58"E   3d30'17.47"N 0.000
456423.28       387405.51 0.00
98d36'27.58"E   3d30'17.47"N 0.000
771751.63       47083.39 0.00
101d26'29.35"E  0d25'32.12"N 0.000
^C
=====

thanks.

regards,
Oon Arfiandwi

Quoting Eric Miller <EMiller at dfg.ca.gov>:

> You've mixed up your X's and Y's in the reverse calculation.
>
> C:\>cs2cs +proj=latlong +datum=WGS84 +to +proj=utm +datum=WGS84
> +zone=47
> 98d36'27.58"E 3d30'17.47"N
> 456423.28       387405.51 0.00
>
> C:\>cs2cs +proj=utm +datum=WGS84 +zone=47 +to +proj=latlong
> +datum=WGS84
> 456423.28 387405.51
> 98d36'27.58"E   3d30'17.47"N 0.000
> 387405.51 456423.28
> 97d59'8.086"E   4d7'43.261"N 0.000
>
>
>>>> oon at informatika.org 9/12/2006 5:27:40 AM >>>
>
> Dear All Proj Users & Developers,
>
> I've tried to convert from WGS84 to UTM (zone 47) with cs2cs:
> =====
> minnie\$ ./cs2cs -v +proj=latlong +datum=WGS84 +to +proj=utm
> +datum=WGS84 +zone=47 -r +units=m << EOF
>> 3d30'17.47"N 98d36'27.58"E
>> EOF
> # ---- From Coordinate System ----
> #Lat/long (Geodetic)
> #
> # +proj=latlong +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> # ---- To Coordinate System ----
> #Universal Transverse Mercator (UTM)
> #       Cyl, Sph
> #       zone= south
> # +proj=utm +datum=WGS84 +zone=47 +units=m +ellps=WGS84 +towgs84=0,0,0
> 456423.28       387405.51 0.00
> =====
>
> point 3d30'17.47"N 98d36'27.58"E in WGS84 converted into UTM (zone47)
> (X,Y,Z) = (456423.28,387405.51,0.00)
>
> Then I want to reverse it back to WGS84.
> I only replace the syntax of cs2cs, before "+to" replace with after
> "+to".
>
> =====
> minnie\$ ./cs2cs -v +proj=utm +datum=WGS84 +zone=47 -r +units=m +to
> +proj=latlong +datum=WGS84 << EOF
>> 456423.28       387405.51 0.00
>> EOF
> # ---- From Coordinate System ----
> #Universal Transverse Mercator (UTM)
> #       Cyl, Sph
> #       zone= south
> # +proj=utm +datum=WGS84 +zone=47 +units=m +ellps=WGS84 +towgs84=0,0,0
> # ---- To Coordinate System ----
> #Lat/long (Geodetic)
> #
> # +proj=latlong +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> 97d59'8.086"E   4d7'43.261"N 0.000
> minnie:~/Desktop/WGS84/proj-4.4.9/src oon\$
> =====
>
> The point UTM (zone 47) (X,Y,Z) = (456423.28,387405.51,0.00) no
> reversible
> into 3d30'17.47"N 98d36'27.58"E in WGS84.
> But the result said "97d59'8.086"E   4d7'43.261"N 0.000"
>
>
> What's wrong with my cs2cs syntax?
>
> btw, why does the Proj library (or cs2cs command) didn't calculate the
> zone automatically for UTM?
> (the manual describe the UTM Zone: every 6 deg, start from 180W to
> 180E)
>
> thanks.
>
>
> --
> regards,
> Oon Arfiandwi
> Software Engineer,
> Bandung, Indonesia.
>
>
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>
>

```