Search code examples
azuregeojsonazure-maps

Upload operation fails for zip file: Azure maps dataset


I'm following this tutorial to be able to upload a set of geojson files (zip), to be used as an Azure Maps Creator dataset. The tutorial states that I need to create a zip file filled with geojson files, for each feature class, following the ontology 2.0 structure. All the geojson files inside the zip are in the root directory, as subdirectories are not supported.

I created this file and followed the other steps. I sent a POST request to

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

With the Content-type header being application/vnd.geo+json. The tutorial states that the content type needs to be application/zip, but when I try this, I get the following response:

Invalid Content-Type value. Allowed value(s): application/json, application/octet-stream, application/vnd.geo+json

Taking this in mind, application/vnd.geo+json seems to be the most suiting option as the files inside the zip are geojson. Sending the request gives you another link where you can check the status of the upload operation. GETting that url gives the following response body:

{
    "operationId": ...,
    "created": "2023-08-31T03:34:18+00:00",
    "status": "Failed",
    "error": {
        "message": "An error occurred while processing your request.",
        "details": [
            {
                "code": "DataValidationFailed",
                "message": "Upload request failed. Your data has been removed as we encountered some problems with it.",
                "details": [
                    {
                        "message": "Invalid ZIP file."
                    }
                ]
            }
        ]
    }
}

At this point in time, the request only tried to upload the zip data. It did not try to create a data set yet (this is another request). Do I need to take specific steps to be able to upload a zip file? I do not see what can be wrong with the file.


Solution

  • Try using application/octet-stream as that is the standard content header type used for zip files in general. This doc uses application/octet-stream https://learn.microsoft.com/en-us/azure/azure-maps/tutorial-creator-indoor-maps