# GM_FindNearestFeatures by World Bounds

rmartinez
Global Mapper UserPosts:

**4**
Mike,

I am using the GM_FindNearestFeatures to find all features for a given world bound. I call GM_FindNearestFeatures with the following parameters:

GM_FindNearestFeatures

( aPixelSearchPt = NULL

, aLayerList = NULL

, aLayerCount = 0

, aFindFlags = 15

, aWorldBounds = myBounds

, aPixelRect = NULL

, aNearestFeatures = pFeaturesFound

, aMaxFeatures = 10

, &totalFound

, aMaxDistPixels = 0);

where myBounds is

myBounds.MaxX = 1502591.69960373

myBounds.MaxY = 168499.379247473

myBounds.MinX = 1502545.99909224

myBounds.MinY = 168452.291824168

My result is as follows:

totalFound = 3

//Result 1

pFeaturesFound[0].mPos.X = 1501891.87878376

pFeaturesFound[0].mPox.Y = 168749.634374269

//Result 2

pFeaturesFound[1].mPos.X = 1502117.00423401

pFeaturesFound[1].mPox.Y = 169010.338020676

//Result 3

pFeaturesFound[2].mPos.X = 1500877.2517545

pFeaturesFound[2].mPox.Y = 205614.817479635

I’m having a hard time understanding the above results. None of the above points reside in my search region. Can you please explain? Am I doing something wrong?

Thanks,

Rebecca

I am using the GM_FindNearestFeatures to find all features for a given world bound. I call GM_FindNearestFeatures with the following parameters:

GM_FindNearestFeatures

( aPixelSearchPt = NULL

, aLayerList = NULL

, aLayerCount = 0

, aFindFlags = 15

, aWorldBounds = myBounds

, aPixelRect = NULL

, aNearestFeatures = pFeaturesFound

, aMaxFeatures = 10

, &totalFound

, aMaxDistPixels = 0);

where myBounds is

myBounds.MaxX = 1502591.69960373

myBounds.MaxY = 168499.379247473

myBounds.MinX = 1502545.99909224

myBounds.MinY = 168452.291824168

My result is as follows:

totalFound = 3

//Result 1

pFeaturesFound[0].mPos.X = 1501891.87878376

pFeaturesFound[0].mPox.Y = 168749.634374269

//Result 2

pFeaturesFound[1].mPos.X = 1502117.00423401

pFeaturesFound[1].mPox.Y = 169010.338020676

//Result 3

pFeaturesFound[2].mPos.X = 1500877.2517545

pFeaturesFound[2].mPox.Y = 205614.817479635

I’m having a hard time understanding the above results. None of the above points reside in my search region. Can you please explain? Am I doing something wrong?

Thanks,

Rebecca

## Comments

4I realized what I was doing wrong right after I did the post.

When getting the point feature (by GM_GetPointFeature), I was assuming that all returned results from GM_FindNearestFeatures would be points, forgetting that I call GM_FindNearestFeatures to search for everything. Therefore when I was calling GM_GetPointFeature when I should have been calling GM_GetLineFeature. After I corrected my mistake, things look as I would have expected.

thanks.