[Proj] Projecting a rectangle to another coord. system?

Glynn Clements glynn.clements at virgin.net
Fri Sep 10 07:08:48 EDT 2004

Mikael Rittri wrote:

> My problem is:
> - I have a rectangle given in coordinate system A
>   (defined by its southwest and northeast corners).  
> - In coordinate system B, I need to find one, or possibly
>   two, rectangles that cover all of the original rectangle.
>   The new rectangle(s) don't have to be as small as possible,
>   although this would be nice.  (They shouldn't be much too 
>   large, though.)
> (By a "coordinate system", I mean a geodetic datum plus a projection.)  
> Can proj4 (or some other tool) solve this problem in the general case?

Technically, no. However, you may be able to get sufficiently close in
all realistic cases.

The simplest technique is to sample the source rectangle, project all
of the sample points, compute the bounding box of the projected
points, then increase the result slightly.

A more accurate technique would be to adaptively resample at higher
resolutions the portions of the border whose projections lie closest
to the bounding box.

There are cases where this approach can fail, i.e. where the
projection of an interior point lies far outside of the projected
border (e.g. projecting from a polar projection to a cylindrical one). 
However, these cases tend not to occur in practice, as the level of
distortion tends to make the resulting data too inaccurate to be of
any practical use.

Glynn Clements <glynn.clements at virgin.net>

More information about the Proj mailing list