In the first article, I describe how to insert and navigate a Virtual Earth Map in your asp.net page.
Here, I describe how to search a Point of Interest (POI) in your map.
The Map control includes a function called Find.
This function accepts ten parameters:
What: a string you want to search
Where: a string where you want to search
FindType: enum VEFindType (Now there is only value: Business)
ShapeLayer: a VEShapeLayer object where the pushpin are placed
StartIndex and NumberOfResults: parameters to manage the search results
ShowResults: if true, the pushpin are placed on the POI
CreateResults: if true, the pushpin are created
UseDefaultDisambiguation: if true, the default form is shown with much disambiguation in the first and second parameters
SetBestMapView: if true, the map moves automaticaly on the result
Callback: function called when the search are finished
In our example we use only the first and the second parameters.
Add the follow html code to the first example:
Search:
<input id="txtPOI" type="text" name="txtPOI"/>
<input id="txtAddress" type="text" name="txtAddress"/>
<input id="find" type="button" value="Find" name="find"
onclick="Find();"/>
Add the follow javascript to the
first example:
function Find()
{
try
{
map.Find(
document.getElementById('txtPOI').value,
document.getElementById('txtAddress').value
);
}
catch(e)
{
alert(e.message);
}
}
Now, launch the page and try to search something.
In the attachment you find the example page that I created.
VirtualEarth2.zip (1.02 kb)