Change projection on tiff and export it with changed projection as raster data
Hello.
How can I change the projection in a tiff layer and then export it as raster layer with changed projection?
I have a tiff file and I load it with GM_LoadLayerListEx. I then extract the layer from the layerList and the layerInfo.
What I want to do is to change the projection of the layer and then export it to an image format with the changed projection. For changing the projection, I have a file tiffProjName that is loaded (.prj file)
GM_Projection_t loadedProj;
GM_Error_t32
theError = GM_LoadProjectionFile(tiffProjName, &loadedProj);
theError = GM_SetProjection(&loadedProj);
The projection is now the one I want (loadedProj)and I want to export it with the new projection as an image.
theError=GM_ExportRaster(“d:\\newProjFile.png”, GM_Export_GeoTIFF,_theTiffLayer,&_tiffLayerInfo->mGlobalRect, _tiffLayerInfo->mPixelWidth,_tiffLayerInfo->mPixelHeight,GM_ExportFlags_JPGinTIFF);
Here I have the error code 8 no data to export.
Can u please tell me what is wrong?
If this is not a solution, is there a solution to change the tiff layer projection and then export it as an image with the new projection?
Thank you,
Dana
How can I change the projection in a tiff layer and then export it as raster layer with changed projection?
I have a tiff file and I load it with GM_LoadLayerListEx. I then extract the layer from the layerList and the layerInfo.
What I want to do is to change the projection of the layer and then export it to an image format with the changed projection. For changing the projection, I have a file tiffProjName that is loaded (.prj file)
GM_Projection_t loadedProj;
GM_Error_t32
theError = GM_LoadProjectionFile(tiffProjName, &loadedProj);
theError = GM_SetProjection(&loadedProj);
The projection is now the one I want (loadedProj)and I want to export it with the new projection as an image.
theError=GM_ExportRaster(“d:\\newProjFile.png”, GM_Export_GeoTIFF,_theTiffLayer,&_tiffLayerInfo->mGlobalRect, _tiffLayerInfo->mPixelWidth,_tiffLayerInfo->mPixelHeight,GM_ExportFlags_JPGinTIFF);
Here I have the error code 8 no data to export.
Can u please tell me what is wrong?
If this is not a solution, is there a solution to change the tiff layer projection and then export it as an image with the new projection?
Thank you,
Dana
Comments
-
Dana,
That looks correct, but when did you get the _tiffLayerInfo structure? If you got that before calling GM_SetProjection the mGlobalRect will still be of the old projection. You need to call GM_GetLayerInfo after calling GM_SetPRojection so that the global bounds will be updated to the new projection.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Guru
gmsupport@bluemarblegeo.com
http://www.globalmapper.com
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 636 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website