The following article is a step-by-step walk through for using the Google Cloud Storage web interface to set up and store data to be processed by the Maps Made Easy API.
Setting up the Google Cloud Project
After making your Google Cloud account, you will need to make a project to associate your data with. If you do not create one when prompted to make one at start up you can go to the IAM & Admin section in the left menu or click here: https://console.cloud.google.com/iam-admin/projects
Click Create Project
Enter a meaningful Project name. Here we used "my-mapsmadeeasy-api-data"
The "my-mapsmadeeasy-api-data" is now visible on the Projects list.
Go back to the Dashboard. You will likely see that the newly created project is selected as the current project. If it is not, please select it. https://console.cloud.google.com/home/dashboard
Set up Bucket and Data
Expand the left side menu by clicking the bars in the top left corner and click Storage.
Here you will see a list of default buckets. Click Create Bucket to make a new holder for our data.
Enter a meaningful-ish bucket name. Here we entered "mme-api-1234". Bucket names are unique within a region so you will have to find one that is not taken.
Now that we have created a bucket we an add data to it. Click Create Folder to make a new place to store data within the bucket.
Give your folder a meaningful name.
Now let's put some data in the folder. Click Upload Files to open the dialog.
Select the files you would like to process for this single API job.
Monitor their upload to Google Cloud Storage.
The files have been successfully uploaded.
Create Access Credentials
To give Maps Made Easy access to your data in a controlled way you will need to create an access key pair to let the Maps Made Easy system retrieve your source data and return your finished products.
On the left side in the Storage menu, click on Settings and then click on the Interoperability tab on the right side.
Make sure that the created projected is designated and click Create a new key. These values will be used in submitting the job to Maps Made Easy. Keep them safe since they would allow anyone who has them to store data in your buckets and incur charges.
Submit the API Job
There are a lot of ways to submit jobs using the MME API. This method using the Raw Data submission box at the bottom of the API endpoint page https://www.mapsmadeeasy.com/api/v1.1/jobs/
Filling in the required values with some sample data, information about the created bucket/path, and the access credential will allow you to submit the job by hitting the POST button.
NOTE: In order to make sure the submitting user and the system are on the same page with regard to what is being submitted, the user is required to calculate their own point total.
Total Points = Image X Resolution * Image Y Resolution * Number of Images * .2
This value is then rounded down to the nearest whole value.
Upon job submission, the system will download some sample images and check your math. It will only proceed if the user's calculated value and the system's calculated value match. It they do not, there will be a message in the status message part of the return.
In this case Total Points = 4000 * 3000 * 13 * .2 or 31.2 points. The value of 31 should be submitted with the POST.
This is the Raw JSON that was submitted.
{
"internal_id": "Sample Internal Identifier",
"name": "API Test",
"description": "This is my first API test!",
"source_storage_type": 2,
"source_storage_bucket": "mme-api-1234",
"source_storage_path": "SamplePath",
"source_storage_id": "GOOGNZX7QOL26DKULMEZ",
"source_storage_secret": "/zLODb32knMiwAigarqGwOrU+G/lEwnLRfkYhz2S",
"submitted_point_total": 31,
"destination_storage_type": 2,
"destination_storage_bucket": "mme-api-1234",
"destination_storage_path": "HeyLookAtTheFiles",
"destination_storage_id": "GOOGNZX7QOL26DKULMEZ",
"destination_storage_secret": "/zLODb32knMiwAigarqGwOrU+G/lEwnLRfkYhz2S"
}
The job gets submitted successfully. Note the status_message at the bottom. If that does not start with OK there was an issue and there will be a descriptive error code.
Now that the job has been submitted, it's running state can be tracked at the following URL:
https://www.mapsmadeeasy.com/api/v1.1/jobs/?running=1
It takes a couple of minutes to start running, so if there are no other jobs running this will be the response.
After a few minutes the job will show and the progress value will be updated according. The progress here and in the screenshot below are currently 23%.
The progress mirrors what is seen in the normal Maps Made Easy Map Detail page. All data posted via the API is also available using the standard browser methods.
The Results
Once the jobs is completed, it will no longer show up using running=1 query and the data output values in the job will be updated. The URLs are for files that are only created for API jobs and the JSON file contains pointers to the standard file outputs and their locations.
The API-only files also got uploaded to the destination_storage_bucket and destination_storage_path designated in the submission in addition to being temporarily hosted at the links shown.
Comments