Le Thursday 16 July 2009 10:41:02 Smart, Gary, vous avez écrit : > > But how do I load a OGRSpatialRef object with the output from the > GDALApplyGeoTransform? Presumably I can prime the OGRSpatialReference > using the result of GDALDataset::GetProjectionRef?
Yes, almost. See below > I'm not yet sure of my > terminology but is the GetProjectionRef supposed to satisfy the OGR > importFromWkt (the types seem to clash though - char* vs char**)? Maybe the doc of OGRSpatialReference::importFromWkt() (see http://gdal.org/ogr/classOGRSpatialReference.html#b74cfc985bd05404a4c61d2d633a6343) isn't clear enough ? I must confess that the prototype is a bit weird. You don't pass the string itself, but a pointer to a string. The pointer will be modified to point to the remaining (unused) input, what you generally don't care about. Ok, here's a sample snippet : OGRSpatialReferenceH hSRS = OSRNewSpatialReference(NULL); const char* pszWkt = GDALGetProjectionRef(hDS); OSRImportFromWkt(hSRS, (char**) pszWkt); (For the purists, a more correct prototype of importFromWkt () would have relied on 'const char**' to avoid the above cast) But a simpler approach would be just : OGRSpatialReferenceH hSRS; hSRS = OSRNewSpatialReference(pszWKT); which instanciates the OGRSpatialReferenceH object and call internally importFromWkt() > > I suspect my output projection could then be set up with > SetWellKnownGeogCS("WGS84") in order to convert from whatever input > projection prevails, to a standard WGS84 lat/long representation (using > OGRCreateCoordinateTransformation::Transform)? Yes. Actually, it will be long/lat in term of the order of the coordinates. _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev