Global Mapper v25.0

Gm_RepositionLayer problem

dana5dana
dana5dana Global Mapper UserTrusted User
edited June 2013 in SDK
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

Comments

  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited June 2013
    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 );
  • global_mapper
    global_mapper Administrator
    edited June 2013
    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
  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited June 2013
    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
  • global_mapper
    global_mapper Administrator
    edited June 2013
    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