Share via

Azure Maps Dynamic Styling dosnt work

David Schmidt 11 Reputation points
2021-12-17T00:18:14.313+00:00

Hello Guys, we are trying now for a couple of days to get Azure Maps Service running. We have a Customer which want to use it an productiv way. For that we have to implement an small POC.

But we have a Problem with changing the Color of rooms inside of the HTML View. Following the basic tutorial didnt work(tutorial). The console inside of the browser dosnt show any error.

Uploading an sample of the index.html inside of the question dosnt work.

Note inside of the HTML: we have set the Options for the EU scope of Azure Maps, also an stateset is given and the setDynamicStyling function is set to true. The subscriptionKey is set staticly. I looked through the other posts inside of Q&A of which none was solving the problem for me.

Checking the API via

   https://eu.atlas.microsoft.com/featureStateSets?subscription-key=xxx&api-version=2.0  

through Postman provides following Stateset:

   "statesetId": "xxx",  
               "datasetIds": [  
                   "xxx"  
               ],  
               "statesetStyle": {  
                   "styles": [  
                       {  
                           "keyName": "occupied",  
                           "type": "boolean",  
                           "rules": [  
                               {  
                                   "true": "#FF0000",  
                                   "false": "#00FF00"  
                               }  
                           ]  
                       }  
                   ]  
               },  
               "description": ""  

So the stateset is mapped to the proper dataset.

The state was set via:

   https://eu.atlas.microsoft.com/featurestatesets/xxx/featureStates/UNIT26?api-version=2.0&subscription-key=xxx  

the request body is:

   {  
       "states": [  
           {  
               "keyName": "occupied",  
               "value": true,  
               "eventTimestamp": "2021-12-17T05:10:20"  
           }  
       ]  
   }  

checking the state with:

   https://eu.atlas.microsoft.com/featureStateSets/xxx/featureStates/UNIT26?subscription-key=xxx&api-version=2.0  

the response for unit26 is:

   {  
       "states": [  
           {  
               "keyName": "occupied",  
               "value": true,  
               "eventTimestamp": "2021-12-17T05:10:20"  
           }  
       ]  
   }  

After checking all the things there is no point of failure which i can see. Can you guys please check if you can reproduce the error?

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.


1 answer

Sort by: Most helpful
  1. David Schmidt 11 Reputation points
    2022-01-05T10:29:30.557+00:00

    Hi asergaz,

    we have found a workaround for the problem. After analyzing the code, we noticed requests that access the American servers despite the changed geography. Now that we have moved everything to the US servers, the dynamic styling works. My guess is that it is related to the SDK which wants to retrieve the style via the American servers, but this fails because the Azure Maps resource is in the European scope.

    Thanks for your help!

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.