FindNearby method
Finds nearby places around a specified location, route, or route segment. Results are sorted in distance order, from closest to farthest, and are limited to the currently visible PlaceCategory objects. Returns a FindResults collection.
Applies to
Collections: Directions
Syntax
object.FindNearby(Distance)
Parameters
Part | Description |
---|---|
object | Required. An expression that returns a collection or object in the Applies to list. |
Distance | Required Double. The distance to search, in GeoUnits. |
Remarks
The map view is changed to the best map view of the find results. To return to the map view that existed before the FindNearby method was used, use the GoBack method on a Map object.
To return or set GeoUnits, use the Units property of an Application or MappointControl object.
Example
Sub GetClosestPointOfInterest()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
'Set up application
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True
'Get a location on the map
Set objLoc = objMap.FindResults("Seattle, WA").Item(1)
'Find nearby places 2 miles from that location
MsgBox "Closest nearby place: " + objLoc.FindNearby(2).Item(1).Name
End Sub
Note This sample code is specific for use in MapPoint North America; it is for illustration purposes only.