Hi,
I am not a projection specialist, but as nobody seems to have answered
your question, I can give a try:
Gatrell, Mark (UK) wrote:
>Hi
> Some time back I posted a question regarding re-projecting an image of known geographic position.
> Adam very kindly tried to explain to me my misunderstanding and I thought I understood.
>
> Ummm, There are still some issues that I'm not comfortable with.
>
> Would you mind?
>
> Let me set the scene again.
>
> I have an image that covers a 20KM tile of OSGB36 TQ88 1:50000 raster scanned map
> so bottom left = eastings 580000 northings 180000
> bottom right= eastings 600000 northings 180000
> top right= eastings 600000 northings 200000
> top left = eastings 580000 northings 200000
>
> So I set the "Current Projection" to British National Grid, set the datum to OSGB36 and set the local offset to the bottom left grid co-ordinate I.E. X = 580000 Y = 180000.
>
>
>
Well so far, it seems you have perfectly understood the problem of map
projection.
> Then pressed the "ok" button , ready to set the target projection.
>
> Adam had previously implied that this was correct.
>
> My question is this:- How does Manifold know the extent of my image if all it has is one co-ordinate i.e. the bottom left local grid value?
>
>
The answer is: it can't. I have never used your tool, but it seems
obvious it has obtained the information it needed from somewhere.
It needs one of the following:
- easting and northing of the opposite point (ie top right)
- size of the full image in meters: remind that British National
Grid is an UTM projection, easting and northing are in meters, so if
Manifold knows your map is 20km wide by 20km tall, it will easily
compute the top right easting and northing by adding 20000 meters to the
bottom left easting and northing.
- width and height of a pixel in meters, which is (often, but not
always) related to the map scale.
- any other information you can think of that will help computing
the upper right easting and northing......
> I'm not sure if the centre co-ordinate box is referring to the centre of the image. I would assume so and this would give Manifold the information it needs to know the extent of the image.
> So should I also enter these details into the centre co-ordinate box. By the way .. The help file refers to a (parameter box). Is this the centre co-ordinate box?
>
>
>
Well, as I said before, I cannot help you using Manifold. This is an
OpenMap mailing list, remember...
> Moving on to the next stage.. The target projection needs to be Orthographic WGS84.
> After setting this I set the centre co-ordinate to the equivalent WGS84 lat long and away we go.
>
>
The transformation from (x0,y0) in British National Grid coordinates to
(x1, y1) in Orthographic coordinates is done this way :
(Let's use BNG for British National Grid projection)
Step 1: apply the inverse BNG projection to (x0,y0) to obtain
(latitude0, longitude0) in the OSGB36 reference frame.
Step 2: apply the datum transformation formula to (latitude0,
longitude0) to obtain (longitude1, latitude1) in the WGS84 reference frame.
Step 3: apply the direct orthographic projection to (longitude1,
latitude1) to obtain (x1, y1) in orthographic coordinates.
You may optimize the formula, but this one is rather generic.
To reproject your map, assuming you use OpenMap, or any other API, I
would do the following:
Step 1: Compute the bounding box of your reprojected map in
orthographic coordinates using the method mentioned above (well, it will
not be a box, but more likely something like a curved trapezoid, but
let's consider a box for simplicity). Say that the coordinates of your
map range from (X1,Y1) to (X2,Y2) in orthographic coordinates.
Step 2: Choose a sampling for your projected image, ie: how many pixels
will have your projected image.
Step 3: Pseudo code:
for(int y=Y1; y<Y2; y+=ySampling)
{
for(int x=X1; x<X2; x+=xSampling)
{
// (x,y) are the coordinates of a point in your destination
image
// ie the one in orthographic coordinates.
1. inverse project (x,y) to obtain (lat1,lon1) in WGS84
2. apply datum transform to (lat1,lon1) to obtain
(lat0,lon0) in OSGB36
3. apply British National Grid projection to (lat0,lon0) to
obtain (x0,y0) in BNG coordinates
4. apply the rule of thumb to (x0,y0) to obtain the pixel
coordinates (i,j) in your source image
5. the color of the destination pixel at (x,y) is the color
of the source pixel at (i,j)!
}
}
It is obvious that this code will be rather slow, especially if your
source image and/or destination image is big. But reprojection is rarely
done on the fly!
> Would you mind clarifying these points.
>
> Thanks
>
> Regards
>
> Mark.
>
>
>
Hope I helped ;-)
Hervé
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Mon Jun 21 16:57:59 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:39 EDT