0

I'm using the Azure Maps API to upload a ZIP file containing a DWG drawing and a manifest.json using the following POST request: https://eu.atlas.microsoft.com/mapData/upload?api-version=1.0&dataFormat=zip

I am using the Primary Key from the Azure Maps resource and including it in the header as Subscription-Key. The ZIP file is correctly structured and contains: A DWG file. A manifest.json file properly formatted. The Azure Maps resource exists, and I confirmed its region is West Europe, which supports Maps Creator. Problem: The API consistently returns a 404 Not Found error with the message indicating the resource cannot be found. I double-checked the URL, key, and resource, and everything appears correct. Any help would be appreciated.

upload a ZIP file containing a DWG drawing and a manifest.json into Azure maps

2
  • Use Convert Use to convert a previously imported Drawing Package into map data. Convert DWG package with The Conversion API performs a long-running operation. Commented Jan 23 at 11:19
  • Use zip file containing DWG is uploaded successfully. with below endpoint https://eu.atlas.microsoft.com/mapData?&api-version=2.0&dataFormat=dwgzippackage&subscription-key=********************* Commented Jan 23 at 11:25

1 Answer 1

0

The 404 status code you’re encountering indicates that the requested resource could not be found.

You need to use a URL like this:

https://eu.atlas.microsoft.com/mapData?&api-version=2.0&dataFormat=dwgzippackage&subscription-key=*********************

You must use {Your-Azure-Maps-Subscription-key} with your Primary or Secondary key.

https://{geography}.atlas.microsoft.com

geography is parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.

The geography parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.

Refer to this git and Microsoft Documentation for Conversion of drawing packages.

Below is the code to upload a ZIP file to Maps. Refer to this git for the full code:

def upload_dwg(pipeline, filepath):
    upload_url = pipeline.base_url + "mapData?api-version=2.0&dataFormat=zip&subscription-key=" + pipeline.subcriptionKey
    data = open(filepath, 'rb').read()
    response = requests.post(url= upload_url ,
                        data=data,
                        headers={'Content-Type': 'application/octet-stream'})

    if response.status_code == 202:
        pipeline.ResultUploadOperationsLocation = response.headers["Operation-Location"]
        print("DWG Upload Started...")
    else:
        print("Upload failed with status code: ", response.status_code)
        exit()

    return pipeline

def get_upload_status(pipeline):
    response = requests.get(pipeline.ResultUploadOperationsLocation + "&subscription-key=" + pipeline.subcriptionKey)
    response_json = response.json()

    if response_json["status"] == "Succeeded":
        pipeline.ResultUploadResourceLocation = response.headers["Resource-Location"]
        pipeline.ResultUploadUDID = pipeline.ResultUploadResourceLocation.split("/")[-1].split("?")[0]
        print("DWG upload successful.")
        print("UDID: " + pipeline.ResultUploadUDID)
    elif response_json["status"] == "Failed":
        print("DWG Upload process failed.")
        exit()
    else:
        time.sleep(1)
        get_upload_status(pipeline)
    return pipeline



enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.