[Gdal-dev] projected bounding box
Norman Vine
nhv at cape.com
Mon Jul 14 13:45:15 EDT 2003
Jonathan Coles writes:
> >
> > To do it right, you need to take EACH POINT along
> > each of the edges of the output bounding box (rectangle)
> > and reproject it back into the source projection. For
> > each edge you calculate the appropriate minimum/maximum
> > value in the input projection.
>
> I was afraid of this response.
>
> >
> > it might be easier for you to take your specific application and calculate
> > a "buffer" value.
> > This is obviously a special-case solution, but it's
> > probably a lot simpler and faster than trying to solve
> > the general problem.
> >
>
> That's the problem, this isn't a special case situation. It should
> really work with any projection anywhere on the globe. It certainly is
> something for me to think about though. Perhaps I can come up with a way
> that will guarantee a good buffer value.
FWIW
The *only* way I know of that will do this correctly in the 'general case'
is to back project every point in your new image into the src raster
This works, but unfortunately isn't very quick.
A good case to demonstrate some of the problems involved is going
from a sub-rectangle of a cylndrical projection to a good fitting rectangle
in an azimuthal projection of the same area.
ie try to come up with the projection parameters for an azimuthal projection
that 'fits' the rectangle defined by a zoom box on a mercator projected map
for any zoom box
Note that what is rectangular in one projection is probably not in another
unless they both happen to be cykndrical projections
Hint:
Try using the center point and the actual 'earth size' of the pixel at CP
as primary projection parameters and don't even think about ellipsoidal
variants untill you have a spherical solution
HTH
Norman
More information about the Gdal-dev
mailing list