Patrik, You could do something like:
GCP[] GCPs = dataset.GetGCPs(); double[] adfGeoTransform= new double[6]; Gdal.GCPsToGeoTransform(GCPs, adfGeoTransform, 0); // apply the transformation dfGeoX = adfGeoTransform[0] + adfGeoTransform[1] * X + adfGeoTransform[2] * Y; dfGeoY = adfGeoTransform[3] + adfGeoTransform[4] * X + adfGeoTransform[5] * Y; // calculate the inverse (handling det=0 would also be required) double det = adfGeoTransform[1] * adfGeoTransform[5] - adfGeoTransform[2] * adfGeoTransform[4]; X = ((dfGeoX - adfGeoTransform[0]) * adfGeoTransform[5] - (dfGeoY - adfGeoTransform[3]) * adfGeoTransform[2]) / det; X = ((dfGeoY - adfGeoTransform[3]) * adfGeoTransform[1] - (dfGeoX - adfGeoTransform[0]) * adfGeoTransform[4]) / det; BTW: I recall I already have an open ticket to add these functions (by exposing GDALApplyGeoTransform and GDALInvGeoTransform would be sufficient) in the SWIG interface http://trac.osgeo.org/gdal/ticket/1531 Best regards, Tamas 2009/6/27 patsv <[email protected]> > Hi, all this is my first post to this list. > > I am fiddling with some gps data that I want to plot onto a .BSB chart. > > I think I have understood howto project the gps data to geo-coordinates > with the spatialreference and transformpoints. > > And then it seems possible to translate from screen to geo-coordinates > with GCPToGeoTransform. > > But how to do the inverse geo-coordinate to screen with GCP. > > It seems that the GDALCreateGCPTransformer and GDALGCPTransform can do > both. > > But I cannot find the support in C# or is it hidden in some class? > > > > Regards > > Patrik Svensson > > > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
