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.5K All Categories
- 5.5K Features Discussion
- 314 Downloading Imagery
- 1.3K Elevation Data
- 377 Georeferencing Imagery Discussion
- 611 GM Script Language
- 50 User Scripts
- 112 GPS Features
- 397 Projection Questions
- 803 Raster Data
- 1.3K Vector Data
- 6.5K Support
- 161 Announcement and News
- 893 Bug Report
- 557 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 542 Other Discussion
- 128 GIS Data Sources
- 26 Global Mapper Showcase
- 229 How I use Global Mapper
- 104 Global Mapper Forum Website