# [Proj] Coordinate transformation from meters to longitude/latitude

Gerald I. Evenden geraldi.evenden at gmail.com
Tue Jan 23 14:02:29 EST 2007

```On Tuesday 23 January 2007 11:27 am, Frank Warmerdam wrote:
> Yuriy Rusinov wrote:
> > Hello !
> >
> > I want to transform some cartesian coordinates from its own projection
> > invproj +proj=tmerc +lat_0=0 +lon_0=38.99999952571766 +k=1.000000 +x_0=0
> > +y_0=0 +ellps=WGS84 +units=m +no_defs
> > 7.41094e+06 6.16614e+06
> > Results are
> > 135d51'17.113"W 234d40'40.974"N
> > These data exceeds latitude limits and no errors, no asterisks in
> > output. Is this error and where it can be contains ?  Any ideas ? Thanks
>
> Yuriy,
>
> I see the same result.  I must confess to not understanding the math
> involved, but Transverse Mercator is a projection without a well
> defined boundary at which it becomes invalid.  Instead as you go further
> and further from the central meridian things become more distorted and
> bizarre effects accumulate.  And 7 million meters east of the central
> meridian is a *long* ways.
>
> I think the lesson is that you can't just throw locations several million
> meters from the central meridian into TM and expect meaningful results.
> But worse, the projection itself has no way of indicating it's reduced
> meaningfulness.
>
> Hopefully Gerald will give a less "black box" oriented answer.

The reason for the failure is quite simple and harks back to a long thread
related to the full earth Transverse Mercator projection.

Evaluation of both the forward and inverse of the Transverse Mercator used in
lproj and its predecessors is a polynomial approximation.  As with many of
these types of solutions there is a limited range where arguments produce
valid results.  In geographic coordinates, tmerc longitude is limited to the
range of about ±5° of the central meridian for acceptably precise results.
At the equator 5° is about 560,000m and decreases as one proceeds N-S from
the equator.

In the above example, the easting limit was exceeded by 10 times and thus went
well beyond the capability of the inverse polynomial.  Note also that the
polynomials are bivariate (functions of both x and y or lat and lon) so that
an range excess in one coordinate will affect both axis.

Except for limiting the range of longitude internally to 180° and that the
absolute value of latitude is less than or equal to 90° there is little range
checking of input arguments.  Virtually none for the inverse cases unless
they produce failure in the math operations such as non-convergent
iterations.  In the tmerc case there definitely no check.

The problem would be quite different if the user had used a spherical earth
where a closed form equation if employed and the only problems that would
appear when longitude approaches 180°.
--
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939)  British psychologist

```