FindServiceSoap.ParseAddress Method

FindServiceSoap.ParseAddress Method

Parses a specified address and returns an Address


Public Function ParseAddress (ByVal inputAddress As System.String, ByVal countryRegion As System.String ) As Address


[C#]

public Address ParseAddress  (System.String inputAddress , System.String countryRegion);

Parameters

  • inputAddress
    The address to parse into properties of an Address object. String.
  • countryRegion
    The country or region in which the address is located; used to supply rules for parsing the address passed in the inputAddress parameter. String. Optional.

Remarks

  • For a table showing the country or region format to use for the inputAddress parameter, see the FormattedAddress property.

  • If the countryRegion parameter is not passed, the ParseAddress method attempts to parse the country or region value from the inputAddress parameter. However, to ensure correct address parsing, you should pass the countryRegion parameter.

  • When finding addresses in Hong Kong, you must specify the city as "Hong Kong" or the country as "Hong Kong SAR".

  • The returned Address.FormattedAddress property may not exactly match the address passed in the inputAddress parameter; MapPoint Web Service formats the address, does not include any apartment or suite information, and removes the following characters: * % ) ( +

Example

[Visual Basic]

'Use ParseAddress to parse the user string first, and then find 
'the address
Dim findService As New FindServiceSoap()
Dim myAddress As Address
myAddress = findService.ParseAddress("1 Microsoft Way, Redmond", "United States")

Dim findAddressSpec As New FindAddressSpecification()
findAddressSpec.InputAddress = myAddress
findAddressSpec.DataSourceName = "MapPoint.NA"

'Declare the return variable and find the address
Dim findAddressResults As FindResults
findAddressResults = findService.FindAddress(findAddressSpec)

'Output the result
Console.WriteLine(findAddressResults.Results(0).FoundLocation.Address.FormattedAddress)



[C#]

//Use ParseAddress to parse the user string first, and then find 
//the address
FindServiceSoap findService  = new FindServiceSoap();
Address myAddress;
myAddress = findService.ParseAddress("1 Microsoft Way, Redmond", "United States");

FindAddressSpecification findAddressSpec  = new FindAddressSpecification();
findAddressSpec.InputAddress = myAddress;
findAddressSpec.DataSourceName = "MapPoint.NA";

//Declare the return variable and find the address
FindResults findAddressResults;
findAddressResults = findService.FindAddress(findAddressSpec);

//Output the result
Console.WriteLine(findAddressResults.Results[0].FoundLocation.Address.FormattedAddress);


See Also

  FindServiceSoap Class   |   Address Class   |   UserInfoFindHeader.Context Property