<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>gdalwarp vertical datum shift question</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hi, I have a question regarding gdalwarp.<BR>
<BR>
We would like to update gdalwarp to be able to be used for DEM files<BR>
such that a vertical datum shift can be added to the files, as well as<BR>
the horizontal warp. Especially we would want to be able to use the<BR>
geoidgrids vertical grid shift option.<BR>
<BR>
As an experiment I have edited a line in the gdalwarpkernal.cpp file in<BR>
the function:<BR>
<BR>
static CPLErr GWKNearestNoMasksFloat( GDALWarpKernel *poWK )<BR>
<BR>
((float *)poWK-&gt;papabyDstImage[iBand])[iDstOffset] =<BR>
&nbsp;&nbsp;&nbsp; ((float *)poWK-&gt;papabySrcImage[iBand])[iSrcOffset]-padfZ[iDstX];<BR>
<BR>
such that instead of assigning the src image value, it assigns that<BR>
value with the Z coordinate transform value subtracted. I have checked<BR>
this with some warp transformations from WGS84 to OSGB36 and it appears<BR>
to work to a certain accuracy (within 10's of cm).<BR>
<BR>
One thing I'm unsure of is whether the fact that the transformation from<BR>
destination grid to source grid with the Z value =0 is going to be<BR>
inaccurate or not. Should the &quot;proper&quot; way be to assign this the actual<BR>
Z value from the source file prior to calculating the transformed<BR>
values? This seems that it may be difficult to do as it is using a<BR>
backwards transformation (dest to src) so we don't know the src pixel<BR>
that relates to the dest pixel until after the transformation.<BR>
<BR>
Another obvious issue would be that we would only want this to happen for<BR>
images with a vertical datum associated (like DEMs) and not for other<BR>
georeferenced imagery that we may want to warp.<BR>
<BR>
So before we go down this route too far (since a lot of changes may be<BR>
needed to the code) - does anyone think that this is a feasible idea or<BR>
have any other suggestions (other than using a GIS :) )?<BR>
<BR>
Thanks,<BR>
Mark</FONT>
</P>

<br />
<hr />
<p><font face="Arial" size="1">
Plymouth Marine Laboratory<br />
Registered Office: <br />
Prospect Place<br />
The Hoe<br />
Plymouth  PL1 3DH
</font></p>

<p><font face="Arial" size="1">Website: <a href="http://www.pml.ac.uk">www.pml.ac.uk</a>
<br />
<a href="http://www.pml.ac.uk/pdf/PMLAR2010.pdf">Click here for PML Annual Review 2010 </a>
<br />
Registered Charity No. 1091222<br />
PML is a company limited by guarantee<br />
registered in England & Wales<br />
company number 4178503</font></p>

<p><font face="Arial" size="1" color="green">Please think before you print.</font></p>

<hr />

<p><font face="Arial" size="1">This e-mail, its content and any file attachments are confidential.</font></p>

<p><font face="Arial" size="1">If you have received this e-mail in error please do not copy, disclose it to any third party or use the contents or attachments in any way. Please notify the sender by replying to this e-mail or e-mail forinfo@pml.ac.uk and then delete the email without making any copies or using it in any other way.</font></p>

<p><font face="Arial" size="1">The content of this message may contain personal views which are not the views of Plymouth Marine Laboratory unless specifically stated.</font></p>

<p><font face="Arial" size="1">You are reminded that e-mail communications are not secure and may contain viruses. Plymouth Marine Laboratory accepts no liability for any loss or damage which may be caused by viruses.</font></p>

<hr />
<br />
<br /></BODY>
</HTML>