question

ScottKovacic-3062 avatar image
1 Vote"
ScottKovacic-3062 asked ScottKovacic-3062 edited

Azure Maps Indoor dynamic styling API v2 not working

Hello,

I went through the tutorial a second time to utilize the API v2 at https://docs.microsoft.com/en-us/azure/azure-maps/indoor-map-dynamic-styling for implementing dynamic styling for Creator (Preview) indoor maps. I have used the provided map example and followed through all the steps. After finishing the tutorial, I have a map but it does not dynamically change with the updated HTTP PUT request. Previously in v1, I was using a POST request and was working but now get a 405 Method Not Allowed error message. No errors with the PUT request (200 OK) but I can't seem to add color to the map based on occupancy. I've updated the eventTimeStamp. Verified the tilesetID and statesetID. Any other suggestions?

Thanks,

Scott

azure-maps
· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ScottKovacic-3062 Community Members, SME's on this topic or our team will review your scenario and circle back at the possible earliest time.

0 Votes 0 ·

@ScottKovacic-3062 Apologies for the delay in response. When you say it isn’t dynamically updating, is this a result of you not being able to successfully create a feature stateset?
Can you confirm that you have created a feature stateset then updated the feature state as instructed here?

Also, check suggestions from @96385072 and update us if that helps to resolve the issue.

0 Votes 0 ·
ScottKovacic-3062 avatar image ScottKovacic-3062 AshokPeddakotla-MSFT ·

I re-created all the API calls and created the statesetId and still I'm not able to see the feature state when updated. I can see the map but I can't display color based on occupancy or temperature. I tried the suggestion from 96385072 but, I don't see the map displayed on the screen. I only see some text and lines.

Thanks

0 Votes 0 ·
Show more comments

Hi, we were facing the same issue where the map rendered after following the guide, but the PUT request did not dynamically change the map even though it returned 200OK.

I am not sure how or why, but by using Azure's map example "https://github.com/Azure-Samples/AzureMapsCodeSamples/blob/master/AzureMapsCodeSamples/Tutorials/Creator%20indoor%20maps.html" it worked just fine.

Hope this helps.

0 Votes 0 ·

@96385072 I'm not able to see the map in the sample from Azure. Did you just cut and paste? Is there an adjustment in size that's needed?

0 Votes 0 ·

1 Answer

ScottKovacic-3062 avatar image
1 Vote"
ScottKovacic-3062 answered ScottKovacic-3062 edited

I don't believe this is a solution but I got it to work. I commented out the following code:

<!--<script type='text/javascript'>
var map, indoorManager;
//Your tileset and stateset ID's for Azure Maps Creator.
const tilesetId = 'xxx';
const statesetId = 'xxx';
function GetMap() {
//Initialize a map instance.
map = new atlas.Map('myMap', {
center: [-122.13215, 47.63647],
zoom: 10,
style: 'grayscale_light',
view: 'Auto',
//Add authentication details for connecting to Azure Maps.
authOptions: {
//Use Azure Active Directory authentication.
// authType: 'anonymous',
// clientId: "xxx", //Your Azure Active Directory client id for accessing your Azure Maps account.
// getToken: function (resolve, reject, map) {
// //URL to your authentication service that retrieves an Azure Active Directory Token.
// var tokenServiceUrl = "https://azuremapscodesamples.azurewebsites.net/Common/TokenService.ashx";
// fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
// }
//Alternatively, use an Azure Maps key. Get an Azure Maps key at https://azure.com/maps. NOTE: The primary key should be used as the key.
authType: 'subscriptionKey',
subscriptionKey: 'xxx'
}
});-->


and replaced with this code:

<style>
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
#map-id {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map-id"></div>
<script>
const subscriptionKey = "xxx";
const tilesetId = "xxx";
const statesetId = "xxx";
const map = new atlas.Map("map-id", {
//use your facility's location
center: [-122.13315, 47.63637],
//or, you can use bounds: [# west, # south, # east, # north] and replace # with your Map bounds
style: "blank",
view: 'Auto',
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: subscriptionKey
},
zoom: 19,
});

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.