# [Proj] pj_transform function

Gerald I. Evenden gerald.evenden at verizon.mail
Fri Oct 6 11:26:11 EDT 2006

```On Friday 06 October 2006 4:38 am, Hugo Tyson wrote:
> proj-bounces at lists.maptools.org <> wrote:
> > I want to transform ... this lat/lon 39.739/-104.985...
> > to world mercator project ..with the defintition
> >
> > World Mercator <54004> +proj=merc +latts=0 +lon0=0
> > +k=1.000000 +x0=0 +y0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs <>
> >
> > but the method gives an "error"....
> >
> > this method works fine if i give lat/lon say 42.4182,-74.2643
>
> I've not heard of "world mercator", but looking at the parameters
> it's projecting into a plane tangent to the sphere at lat 0, lon 0.
> So it only works for longitudes from -90 to +90 (though these map
> to infinities in the projected plane).
>
> Your example of -104 longitude is around the back of the earth,
> on the "far side" from the projection plane.   Therefore a
> line from the origin through the point never intersects the
> projection plane, so no result can be calculated.  Hence your
> error.  Lon -74 is in range, so it's OK.

Excuse me for jumping into the middle of this discussion, but Mercator and
normal proj functioning span the range of +-180 degrees longitude.  The plane
of the cylindrical projection projection is "unwrapped" from a cut on the
projection cylinder opposite the longitude of the central meridian (CM) or
180 degrees from the CM.  There is no such thing as the '"far side"' of the
projection.

The following is an example:

gie at charon:~\$ lproj +proj=merc +ellps=WGS84
-104.985 39.739
-11686876.74    4800765.45
-74.2643 42.4182
-8267064.06     5195000.64
gie at charon:~\$

All the other parameters in the original problem are superfluous as they are
default values of proj/lproj.  The datum option is not part of the proj/lproj
system.
```