/ / The default search is the nearest element of the center point of the map
DPOINT PPT = MapControl1.map.center;
Map Map = MapControl1.map;
ISESSION session = mapinfo.Engine.Session.current;
// The radius is set to 5 pixels
Distance d = mapinfo.mapping.searchinfofactory.screeentomapdistance (map, 5);
SearchInfo Si = mapinfo.data.searchinfofactory.Searchnearest (ppt, map.getdisplaycoordsys (), d);
/ / Search all columns
Si.QueryDefinition.columns = null;
// Search one stop search
(Si.searchResultProcessor as CloseSTSearchResultprocessor) .Options = ClosestSearchOptions.stopatfirstMatch
/ / Searching the primitives in DefaultSerection
Session.catalog.search ("asicty79", si, session.selections.defaultselection, resultSetcombinemode.Replace;
// Get FeatureCollection
MapInfo.data.table Table = session.catalog ["asicty79"];
IRESULTSETFEATURECOLLECTION FC = session.Selections.defaultSelection [table];
IF (fc.count == 0)
Response.write ("No photo provided!");
// Need to note is that the layer must be set to you can choose to see the effect on the map.