sathish_indian


Hi,

I am working with Microsoft Virtual Earth. I want to show Adresss. I used VEMap.Find() method to find the address. I passed street name,houseno,city,zipcode,county,state and country informations to find the address.

The problem is I got the address throughout the world which matches the address. But I want to filter the address based on Country entered. So pls kindly assist me to sort out the problem.

Is there a method to filter the address based on country in Virtual Earth Help me.

Thanks in advance.





Re: Filtering Address based on Country in Virtual Earth

Derek Chan


What do you mean You "can" filter by country using the find in the "where" parameter. The format is this:

Address,City, State, Zipcode, Country

example:
17 mile dr, East Waterboro, ME, 04030, United States

Pass in your requests in this format







Re: Filtering Address based on Country in Virtual Earth

SoulSolutions

The trick is to make sure you put comma your country at the end. In Australia for example i can use ,au or ,aus or ,australia. I have found that using the full country name gives the best results.

Check out this article:

http://viavirtualearth.com/vve/Articles/MyGeoLand.ashx

Unfortunalty the site is down until I can get the domain name switched to another server but all the code is there.

John.







Re: Filtering Address based on Country in Virtual Earth

sathish_indian

Hi Derek,

Thanks for ur reply. What should be passed in the "what" parameter of Find method. As of now I passed as "null".

Do I need to give any category name I am new to Virtual Earth. Pls explain.

Thanks for ur help.

By

sathish






Re: Filtering Address based on Country in Virtual Earth

Derek Chan

 sathish_indian wrote:

Hi Derek,

Thanks for ur reply. What should be passed in the "what" parameter of Find method. As of now I passed as "null".

Do I need to give any category name I am new to Virtual Earth. Pls explain.

Thanks for ur help.

By

sathish

 



You don't have to pass anything into the 'what' parameter, as long as you supply the 'where' parameter.  If you do however, 'what' can be anything, for example you could pass 'offices', or 'houses', this 'what' parameter is very generalized and you could pass anything even 'elvis' to it so I can't give you a list of what is available




Re: Filtering Address based on Country in Virtual Earth

sathish_indian

Hi Derek,

Thanks for your reply. I will check it. Hope it will solve the problem. Thanks.






Re: Filtering Address based on Country in Virtual Earth

sathish_indian

Hi derek,

Still it is not filtering based on country. I placed a DropDownList to select the country. I entered a city name that is not in the selected country. But still the map searches that city and shows that country.

Eg. 10th street, salem, Denmark.

Below is the code I used

var address = document.form1('txtno').value + document.form1('txtstreet').value + document.form1('txtcity').value + form1.optstate.value + document.form1('txtzipcode').value + document.form1('txtcounty').value + form1.optcountry.value;

map.Find(null,address,'1',FindResults);

But the salem is a state in India. so It should say there is no matching location for this address. How to do this.






Re: Filtering Address based on Country in Virtual Earth

Derek Chan

Priority wise the city is greater than country. In other words you input incorrect city, but correct coutnry, it will match by city first. The "where" isn't that intelligent so it will not match on the entire search




Re: Filtering Address based on Country in Virtual Earth

Derek Chan

You'll need to do some validation on the parameters being passed to address




Re: Filtering Address based on Country in Virtual Earth

sathish_indian

Hi Derek,

ok. But my requirement is to filter the location based on country. If I enter correct address, the location is shown correclty. But If I enter wrong address also

it shows me the location. That should be stopped. It should first search for the location in the country given. If the location is within the country, it should show

if not it should show me error. Can you suggest a way how to solve this. My client requirement is like this.

Is there any other way.






Re: Filtering Address based on Country in Virtual Earth

Derek Chan

Why would you want wrong addresses to be shown Like you want clients to be able to sort for New york, India Why not have a dropdown that populates what cities their allowed to pick depending on the country, makes more sense. Anyhow, theres no way to modify the behaviour of how the find works




Re: Filtering Address based on Country in Virtual Earth

sathish_indian

Hi Derek,

Thanks for your reply. Actaully the motto is, If he enters New York, India. It should not show any location. Anyway I will try to populate the cities as you said.






Re: Filtering Address based on Country in Virtual Earth

Derek Chan

no problem,

Actually another choice is if it returns more than one result then don't populate cities




Re: Filtering Address based on Country in Virtual Earth

sathish_indian

Hi,

Sorry I re-posted the query by mistake. I used FindResults to show the location if it returns more results. If client accepts the idea which you said, then I will not populate the cities if more results are returned.