GM_LoadRectifiedLayer Problems
Hi
I have this code to load a jpg image (1920X1080) with ground control points and then save it to geotif file.
The first problem is that the saved image is flipped in the X axis.
The second problem is the metadata is incorrect.
I code in Delphi. The @ sign is the address of the data.
Here is the variables:
LLA_Projection:GM_Projection_t;
aGroundControlPoints:Array of GM_GroundControlPoint_t;
aLayerHandle:GM_LayerHandle_t32;
Here is the code :
LLA_Projection.mProjSys:=GM_PRJ_GEO;
LLA_Projection.mDatum :=GM_DATUM_WGS_84;
LLA_Projection.mUnit :=GM_PRJ_UNIT_ARC_DEGREES;
LLA_Projection.mNumAttrs:=1;
LLA_Projection.mAttrList[0].mAttr:=CENTRAL_LONGITUDE;
LLA_Projection.mAttrList[0].mValue:=0;
GM_SetProjection(@LLA_Projection);
SetLength(aGroundControlPoints,2);
aGroundControlPoints[0].mPixelX:=0;
aGroundControlPoints[0].mPixelY:=0;
aGroundControlPoints[0].mGroundX:=77.115;
aGroundControlPoints[0].mGroundY:=28.725;
aGroundControlPoints[1].mPixelX:=0;
aGroundControlPoints[1].mPixelY:=0;
aGroundControlPoints[1].mGroundX:=77.125;
aGroundControlPoints[1].mGroundY:=28.715;
aLoadFlags:=GM_LoadFlags_HideProgress;
GM_LoadRectifiedLayer(StringToPAnsiChar('C:\Temp\test.jpg'),
@aLayerHandle,aLoadFlags,
@aGroundControlPoints,2,
@LLA_Projection);
theErr:=GM_ExportRaster(StringToPAnsiChar('C:\Temp\test.tif'),
GM_Export_GeoTIFF,
aLayerHandle,
Nil,
1920,
1080,
GM_ExportFlags_HideProgress);
GM_CloseLayer(aLayerHandle);
Above is the Original JPG
Below is the file I got.
Can you help please ?
Thanks Allot
Raz
Answers
-
-
I can not load the tif file for some reason....I tried rar and zip
-
It looks like your referencing for the jpg image is not correct:
aGroundControlPoints[0].mPixelX:=0;
aGroundControlPoints[0].mPixelY:=0;
and
aGroundControlPoints[1].mPixelX:=0;
aGroundControlPoints[1].mPixelY:=0;
are referencing the same pixel value, [0,0]. Those should line up with the specific locations in the mGround values, so maybe the first one should be [0,0], and the second should be [imagewidth,imageheight]?
-
Hi
I copied from my code by mistake 0,0
It is 1920,1080
aGroundControlPoints[1].mPixelX:=1920;
aGroundControlPoints[1].mPixelY:=1080;
is there a way I can send you the tif file I am getting ?
Thanks
-
Please send your sample code and source data to geohelp@bluemarblegeo.com . We can take a look and try to help figure out what is going on.
-
Hi
Just send you the code and files.
The subject of the email is:
GM_LoadRectifiedLayer Problems Question By Raz Tidhar
Thanks
Raz
-
Hi
I just my problem.
I have defined the control points as a dynamic array and the function didn't take the correct values.
Changed
aGroundControlPoints:Array of GM_GroundControlPoint_t;
To
aGroundControlPoints:Array[0..1] of GM_GroundControlPoint_t;
Anyway...
Thanks allot for your help !
Raz
-
One more question
Is it possible when saving to tif file to say that the white area will be transparent when loading ?
Thanks
Raz
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 639 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 419 Projection Questions
- 829 Raster Data
- 1.4K Vector Data
- 6.6K Support
- 179 Announcement and News
- 923 Bug Report
- 560 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 574 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website