Share via


BatchGeocodeSpecification.JobName Property

BatchGeocodeSpecification.JobName Property

Provides a user-friendly name for the process.

Public JobName As String

[C#]
public string JobName;

Remarks

Because a geocoding-only job process is not associated with a data source, you can provide a JobName property to track the progress of the geocoding process. The JobName property appears in the job status panel on the MapPoint Web Service Customer Services site (https://mappoint-css.live.com/CSCV3/).

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");
}