projection - GDAL SetProjection is not Retrieved after assigning WGS84 -


i got code set geographic projection geotiff file.

podataset = (gdaldataset *) gdalopen( filename.c_str(), ga_update);  ogrspatialreference osrs; char *pszsrs_wkt = null;  osrs.setwellknowngeogcs( "wgs84" ); osrs.exporttowkt( &pszsrs_wkt ); osrs.setprojcs( pszsrs_wkt );  std::cout<<"setted proj: "<<pszsrs_wkt<<endl; cplerr err = podataset->setprojection( pszsrs_wkt ); std::cout<<"proj error: "<<err<<endl;  double        adfgeotransform[6]; cplerr err2 = podataset->getgeotransform( adfgeotransform ); std::cout<<"error: "<<err2<<endl;  std::string str = podataset->getprojectionref(); std::cout<<"retrieved proj: "<<str<<endl; 

result

proj: geogcs["wgs 84",datum["wgs_1984",spheroid["wgs 84",6378137,298.257223563,a uthority["epsg","7030"]],towgs84[0,0,0,0,0,0,0],authority["epsg","6326"]],primem ["greenwich",0,authority["epsg","8901"]],unit["degree",0.0174532925199433,author ity["epsg","9108"]],authority["epsg","4326"]]**  proj error: 0  error: 3  retrieved proj: 

code seems reasonable, might reason of error?

thanks in advance

well solved problem, when set projection, should have assign new geotransformation too. calling

podataset->setgeotransform(adfgeotransform); 

solved problem.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -