GM_FindNearestFeatures ???

qudduqqudduq Global Mapper UserPosts: 18Trusted User
edited December 2012 in SDK
I'm have a problem with FindNearestFeatures
search area.

GM_Rectangle_t aWorldBounds;
aWorldBounds.mMinX = 224250.773000;
aWorldBounds.mMaxY = 192359.633000;
aWorldBounds.mMaxX = 224750.771000;
aWorldBounds.mMinY = 191859.635000;

// Do the search
uint32 theFoundCnt = 0;
GM_Error_t32 theRetVal = GM_FindNearestFeatures
(
NULL,
NULL, // search all loaded vector layers
0,
GM_FindFlags_GetAllFeatures + GM_FindFlags_FindAreas, //i want search area
&aWorldBounds,
NULL,//&theDrawRect,
theResultsList,
m_iFeatureCount,
&theFoundCnt,
aSearchRadius
);

// Add the results to our list
for ( uint32 i = 0; i < theFoundCnt; i++ )
{
theFoundFeatureList.push_back( theResultsList );
}
// TRACE("theFoundFeatureList.size() = %d\n",theFoundFeatureList.size());
// Free the results list buffer
delete[] theResultsList;
=====================================================
i want with aWorldBounds < area find >

=====================================================

desired result

1.png
==================================================
actual result

2.png
1.png 117.4K
2.png 147.6K

Comments

  • qudduqqudduq Global Mapper User Posts: 18Trusted User
    edited December 2012
    test data ^^
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2012
    The nearest search will find all features whose bounding box intersects the provided bounding box. It doesn't actually crop the features to the bounding box, so you would get features that aren't actually in the box but whose bounding box intersects the search box.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • qudduqqudduq Global Mapper User Posts: 18Trusted User
    edited December 2012
    Look at the test data

    B4 and Test area Features is selected? is correct?

    give aWorldBounds; and
    i want B4 Features is find
    how to coding?

    // Do the search
    uint32 theFoundCnt = 0;
    GM_Error_t32 theRetVal = GM_FindNearestFeatures
    (
    NULL,
    NULL, // search all loaded vector layers
    0,
    GM_FindFlags_GetAllFeatures + GM_FindFlags_FindAreas, //i want search area
    &aWorldBounds,
    NULL,//&theDrawRect,
    theResultsList,
    m_iFeatureCount,
    &theFoundCnt,
    aSearchRadius
    );

    333.JPG
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited December 2012
    You would need to do an actual clip test on the returned results if you don't just want the quick search results of which feature's bounding boxes intersect the provided bounding box. You would need to get the geometry of the returned features and see if either the bounding box is completely inside your search box or at least one edge crosses into your box.

    If you have the latest SDK (v14) I might also be able to add a flag to do the clip test directly in SDK and get you a new build.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
Sign In or Register to comment.