Gm_RepositionLayer problem
Hello,
I wrote this code but the layer does not reposition ... what do I do wrong? const int nb = 100; GM_GroundControlPoint_t theGCPList[nb]; memset( theGCPList, 0, sizeof theGCPList ); double theShiftX = 300.0; double theShiftY = -150.0; for(size_t i = 0; i < nb; i++) { theGCPList.mPixelX = i; theGCPList.mPixelY = i; theGCPList.mGroundX = theGCPList.mPixelX + theShiftX; theGCPList.mGroundY = theGCPList.mPixelY + theShiftY; } GM_RepositionLayer( newLayer, theGCPList, nb , NULL );Thank you,Dana
I wrote this code but the layer does not reposition ... what do I do wrong? const int nb = 100; GM_GroundControlPoint_t theGCPList[nb]; memset( theGCPList, 0, sizeof theGCPList ); double theShiftX = 300.0; double theShiftY = -150.0; for(size_t i = 0; i < nb; i++) { theGCPList.mPixelX = i; theGCPList.mPixelY = i; theGCPList.mGroundX = theGCPList.mPixelX + theShiftX; theGCPList.mGroundY = theGCPList.mPixelY + theShiftY; } GM_RepositionLayer( newLayer, theGCPList, nb , NULL );Thank you,Dana
Comments
-
Sorry the code was like that ....
const int nb = 100;
GM_GroundControlPoint_t theGCPList[nb];
memset( theGCPList, 0, sizeof theGCPList );
double theShiftX = 300.0;
double theShiftY = -150.0;
for(size_t i = 0; i < nb; i++)
{
theGCPList.mPixelX = i;
theGCPList.mPixelY = i;
theGCPList.mGroundX = theGCPList.mPixelX + theShiftX;
theGCPList.mGroundY = theGCPList.mPixelY + theShiftY;
}
GM_RepositionLayer( newLayer, theGCPList, nb , NULL ); -
You are setting the pixel X and Y to the same value for each point, so you will have a series of control points along a single long line down the diagonal of the image. Are you getting any kind of error back from the GM_RepositionLayer call?
What exactly are you trying to do? If you want to shift the layer by the shift X and Y amount you will want to call GM_GetLayerInfo to get the existing list of control points, then add your shift X and Y amount to the ground coordinates for each point, then call GM_RepositionLayer with the new list.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation -
I have a problem with las loading after tiff when I want to change the projection.
The scenario that I apply is:
1. Load tiff file
2. Apply the desired projection to the tiff file
3. Load the .las file with the desired projection
-> the result for this is that they do not match
When I try also with the Global Mapper API they do not overlay...
But if I load them in the tiff's projection
1. Load the tiff
2. Load the las file in tiff's projection
3. Change projection from configure
They overlay and they are both in the desired projection...
What is the flow? I use GM_SetProjection to set projections for both of them if not setting the desired projection to each of them?
Thank you,
Dana -
Dana,
The GM_SetProjection function is to change the view/export projection, it doesn't change the native projection interpretation for each layer. When you load your TIFF and LAS in the SDK are you being prompted to select a projection for the layer or is one automatically being selected? If the wrong one is selected at load time you can correct it by calling GM_RepositionLayer with the new native projection for the layer and passing NULL for the control point list so you don't update that, but just the native projection interpretation.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
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
- 825 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 912 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