GM_FindNearestFeatures ???
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
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
Comments
-
test data ^^
-
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 -
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 -
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
Categories
- 12.9K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 643 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 419 Projection Questions
- 829 Raster Data
- 1.4K Vector Data
- 6.6K Support
- 180 Announcement and News
- 926 Bug Report
- 561 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 574 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website