Different behaviour of GM_FindNearestFeatures in 16 and 19 SDK versions

Yann DUPUY
Yann DUPUY Global Mapper UserTrusted User
Hi,
I upgraded my software to GlobalMapper 19 SDK and a perfectly working piece of code is now broken.

My call to
    GM_Error_t32 status = GM_FindNearestFeatures(&pix, layers, visibleLayerCount, GM_FindFlags_FindAll, 0, 0, foundFeatures, maxSearchedFeatures, &featureCount, maxSearchDistPixels);

now returns a #2 error (Parameter error), and not a #0 error None anymore.

Did something change ?
Did I miss something ?
Will somebody read this message and help me ?

Thanks,
Yann


Comments

  • Mithra
    Mithra Trusted User
    Hello Yann,

    I tried to replicate your error but mine worked just fine.

    I would suggest you to make sure that aFoundFeatureCnt, aPixelSearchPt, aNearestFeatures are not null and aMaxFeatures should be a non-zero value. Please let us know if you still face issues with this.  

    Regards,
    Mithra
  • Yann DUPUY
    Yann DUPUY Global Mapper User Trusted User
    Hi Mithra,
    Thanks for the reply.

    The strange thing is that just by changing the GlobalMapper DLL (I have proper license) the code does not work anymore!

    In my call,

    GM_Error_t32 status = GM_FindNearestFeatures(&pix, layers, visibleLayerCount, GM_FindFlags_FindAll, 0, 0, foundFeatures, maxSearchedFeatures, &featureCount, maxSearchDistPixels);

    pix are the coordinates of my point (and they seem correct)
    layers is an array of two layer handles
    visibleLayerCount=2
    foundFeatures is an allocated pointer to maxSearchedFeatures(=10) GM_FoundFeatures_t
    maxSearchFeatures=10
    featureCount is an uint32 (uninitiliazed but I should not have to)
    maxSearchDistPixels =10

    I can't see anything wrong!

    Regards,
    Yann

  • Yann DUPUY
    Yann DUPUY Global Mapper User Trusted User
    For the record, I think I found my problem.
    It seems that for any reason (a change in handling the pixel aspect ratio in the view ?) I need to specify both world and pixel bounds.
    I don't really have time to search deeper into this, but this allowed me to have my piece of software compatible with GM19 SDK (now that 20 is out!)...

    Yann