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

Ed McNierney ed at topozone.com
Mon Sep 13 18:22:45 EDT 2004

Mikael -

I agree with Glynn's observation that it's hard to imagine a simple,
non-iterative mechanism that will work in "the general case", mainly
because I find it hard to see how to define "the general case".  It
sounds like you want to define it as "all possible cartographic
projections, known and yet to be invented".  Since new cartographic
projections are occasionally invented from time to time to solve new
problems or provide better answers to known problems, it's impossible to
speculate how point X1 in one projection will relate to point X1' in a
second projection.

It is *relatively* easy to construct rules for common projections with
known properties; the 80/20 rule works well here (do 20% of the work and
solve 80% of the cases).

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 978 251-4242   Fax: +1 978 251-1396 

-----Original Message-----
From: proj-bounces at xserve.flids.com
[mailto:proj-bounces at xserve.flids.com] On Behalf Of Glynn Clements
Sent: Monday, September 13, 2004 4:15 PM
To: Mikael Rittri
Cc: proj at xserve.flids.com
Subject: RE: [Proj] Projecting a rectangle to another coord. system?

Mikael Rittri wrote:

> G> It's the reverse case which doesn't work. If you project a 
> G> rectangle which encloses the pole, the north and south edges of the

> G> bounding box will be determined by the min/max latitudes of the 
> G> border points; the projection of the pole will lie above or below 
> G> the bounding box of the projected border.
> But we would need the reverse case as well, because of "demand-driven 
> geodata access" (or whatever it should be called).  When the user 
> looks at a polar projection, the zoom level etc. of his window 
> determines a bounding rectangle which is defined in the polar 
> projection.  The geodata, on the other hand, are defined in lat/lon in

> a database, which can be queried with a bounding lat/lon-rectangle.  
> That is, the database returns only the polygons that intersect the 
> lat/lon- rectangle of interest.  So we need to find a 
> lat/lon-rectangle which covers at least the polar rectangle --- that's
the reverse case.
> Since I thought all GIS systems behave like this, I hoped the fully 
> general problem (including discontinuities) had been solved (and 
> published).

I doubt it. Actually, I'm not sure that it's possible to derive a
mechanism which will work in the general case.

Also, you might do better asking in a forum which is concerned with
numerical methods generally. Essentially, you're looking for a numerical
method to compute the minima and maxima of f(x,y) for arbitrary f where
x and y are bounded. In that sense, the fact that f is being used in a
cartographic projection doesn't really help you.

OTOH, if you had an algebraic representation of the projection function,
you could (potentially) determine the maxima and minima analytically.
However, you can't realistically get this information out of PROJ.

[I have examined the possibility of parsing the PROJ source code, but
it's just too messy, in the sense that it depends too heavily on
imperative constructs.]

I suspect that the most feasible approach is to specify a function to
compute the bounding box on a per-projection basis. Most projections
could use a generic algorithm based upon adaptive sampling, while a few
would need to handle special cases explicitly, using a manually-derived
analytical solution.

Glynn Clements <glynn.clements at virgin.net>
Proj mailing list
Proj at xserve.flids.com

More information about the Proj mailing list