Share via


BatchGeocodeSpecification.RejectAmbiguousGeocodes Property

BatchGeocodeSpecification.RejectAmbiguousGeocodes Property

Indicates whether ambiguous addresses should be skipped or whether they should be assigned the latitude and longitude of the first address that matches the record.

Public RejectAmbiguousGeocodes As Boolean

[C#]
public bool RejectAmbiguousGeocodes;

Remarks

If set to true, ambiguous addresses will be skipped. Otherwise, the first address match will be used.

Example

[Visual Basic]

Dim DataService As New CustomerDataService
DataService.Credentials = New NetworkCredential(myUserName, mySecurePassword, myDomainName)

' Create BatchGeocodeSpecification
Dim uploadSpec As New BatchGeocodeSpecification
uploadSpec.JobName = "BatchGeocodeJob"
uploadSpec.MaximumGeocodingLevel = GeocodingLevel.Street
uploadSpec.RejectAmbiguousGeocodes = True

' Start Batch Geocode
Dim jobID As String = DataService.StartBatchGeocode(uploadSpec)

' Upload data
Dim localUploadStream As New FileStream("c:\uploadfile.xml", FileMode.Open, FileAccess.Read, FileShare.Read)
Dim localUploadReader As New BinaryReader(localUploadStream)
Dim filesize As Long = localUploadStream.Length
Dim bytesPreviouslyUploaded As Long = 0
While (bytesPreviouslyUploaded < filesize)
    Dim localBuffer As Byte() = localUploadReader.ReadBytes(2000)
    bytesPreviouslyUploaded = DataService.UploadData(jobID, localBuffer, bytesPreviouslyUploaded)
End While

DataService.FinishUpload(jobID, filesize)

' Wait for job to complete
Dim jobState As JobState = DataService.GetJobState(jobID)
While (jobState = jobState.Pending OrElse jobState = jobState.InProcess)
    Thread.Sleep(10000)
    jobState = DataService.GetJobState(jobID)
End While

' download the results
If (jobState = jobState.CompletedSuccess) Then
    Dim downloadURL As String = DataService.GetDownloadFileURL(jobID)
    Dim downloadClient As New System.Net.WebClient
    downloadClient.Credentials = New NetworkCredential(myUserName, mySecurePassword, myDomainName)
    downloadClient.DownloadFile(downloadURL, "c:\results.zip")
End If



[C#]

CustomerDataService DataService = new CustomerDataService();
DataService.Credentials = new NetworkCredential(myUserName, mySecurePassword, myDomainName);

// Create BatchGeocodeSpecification
BatchGeocodeSpecification uploadSpec = new BatchGeocodeSpecification();
uploadSpec.JobName = "BatchGeocodeJob";
uploadSpec.MaximumGeocodingLevel = GeocodingLevel.Street;
uploadSpec.RejectAmbiguousGeocodes = true;

// Start Batch Geocode
string jobID = DataService.StartBatchGeocode(uploadSpec);

// Upload data
FileStream localUploadStream = new FileStream(@"c:\uploadfile.xml", FileMode.Open, FileAccess.Read, FileShare.Read);
BinaryReader localUploadReader = new BinaryReader(localUploadStream);
long filesize = localUploadStream.Length;
long bytesPreviouslyUploaded = 0;
while (bytesPreviouslyUploaded < filesize)
{
       byte[] localBuffer = localUploadReader.ReadBytes(2000);
       bytesPreviouslyUploaded = DataService.UploadData(jobID, localBuffer, bytesPreviouslyUploaded);
}

DataService.FinishUpload(jobID, filesize);

// Wait for job to complete
JobState jobState = DataService.GetJobState(jobID);
while (jobState == JobState.Pending || jobState == JobState.InProcess)
{
       Thread.Sleep(10000);
       jobState = DataService.GetJobState(jobID);
}

// download the results
if (jobState == JobState.CompletedSuccess)
{
       string downloadURL = DataService.GetDownloadFileURL(jobID);
       System.Net.WebClient downloadClient = new WebClient();
       downloadClient.Credentials = new NetworkCredential(myUserName, mySecurePassword, myDomainName)
       downloadClient.DownloadFile(downloadURL, @"c:\results.zip");
}