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
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 );
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
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
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