Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a PNG that is referenced to the OSGB36 datum (1 pixel per 50m easting/northing that is colored according to the result of some calculation code)

I want to display this on Google Earth using KML. But obviously I need to transform the image before I do this.

I can manually use gdal_translate to create a TIF file then gdalwarp to convert the image but I want to achieve this in code (C++) not via external applications.

I looked at the GDAL API but having no joy doing what I can easily do with the aforementioned GDAL utilities. seems to doing something similar to what I want but having looked at the JavaScript I don't really understand how the affine transformation is being constructed.

Any pointers on how to achieve this would be much appreciated.

share|improve this question
wtp2 demo by Bill Chadwick uses the Ordnance Survey OpenSpace API - you can view the javascript code at and is pulling the tiles from – Mapperz Jan 29 '13 at 15:35
Yes I have seen that. To be honest I can't really work out how the affine transformation is being constructed and how I could modify it for my scenario. – Alastair Taylor Jan 29 '13 at 20:46
In the end I used ShellExecuteEx to run gdalwarp. I would still be interested in a pure C++ code solution but for now this will have to do. – Alastair Taylor Jan 31 '13 at 17:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.