Using MapPoint you can find both places and addresses among other things.
The code snippet below shows how to find a place:
//Create an instance of ApplicationClass
MapPoint.ApplicationClass app = new MapPoint.ApplicationClass();
//Get a reference to the Map instance via the ActiveMap property
MapPoint.Map map = app.ActiveMap;
The MapClass exposes a method, FindPlaceResults, which returns all places that matches the input query. This method takes place name as string as an input and returns FindResults, which is a collection of locations found. The following code shows the FindPlaceResults method call:
//Call FindPlaceResults on the MapClass instance
MapPoint.FindResults findResults = map.FindPlaceResults(“Space Needle”);
Similarly, you can find addresses using the FindAddressResults method, as shown below:
//Create an instance of the MapPoint application class
MapPoint.ApplicationClass app = new MapPoint.ApplicationClass();
//Get the Map object from the application object
MapPoint.Map map = app.ActiveMap;
//Call the FindAddressResults method
MapPoint.FindResults findResults = map.FindAddressResults(
"498 Broad St",
"Seattle",
string.Empty,
"WA",
"98109",
MapPoint.GeoCountry.geoCountryUnitedStates);
Finally, if you don’t know if an input is a place (POI) or an address, use FindResults method, as shown below:
//Works with finding addresses
MapPoint.FindResults findAddressResults
= map.FindResults("498 Broad St, Seattle, WA, 98109");
//Works with finding places
MapPoint.FindResults findPlaceResults
= map.FindResults("Space Needle");
Now you just have to iterate through find results to get the location information in each case.
To learn more about this topic and other related topics, please buy
Programming MapPoint in .NET