Been fighting with this for 2 days now and i’m not sure what Todo…. and its very simple im trying to add a map to my website just the basic one nothing fancy and the only thing that show’s is NOTHING lol a blank screen. can someone give me some tips on what to look for?
here is my simple yet frustrating code —
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js" type="text/javascript"></script>
<script src="https://atlas.microsoft.com/sdk/javascript/service/2/atlas-service.min.js" type="text/javascript"></script>
$(document).ready(function() {
InitMap();
});
function InitMap() {
//Initialize a map instance.
var map = new atlas.Map('field', {
style: 'satellite',
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: '<Primary KEY>'
}
});
}
any help would be appreciated. Thanks guys/gals 🙂
i’ve tried the following
Checked the compatibility
made sure im using tier G2.
im using my correct key number
the div container is correct with the code
when i right click and look through the code all the data for the map is there and when i hover over that code it lights up on the page as if it were there ( Its Just White ).
2
Answers
To add a map to your website using the Azure Maps Web SDK.
To help you resolve the issue, I would like to suggest you follow the Azure Maps Web SDK best practices.
Thanks to steve munk for the documentation.
Html Code
Sample maps
If the map data is present in the code and the div container is correct, then the next step would be to check the console in the browser’s developer tools for errors.
Steps to check the browser’s developer tools.
Right-click on the blank map and select "Inspect" or "Inspect Element".
The browser’s developer tools will open.
Go to the "Console" tab.
Check for any errors that may be causing the map not to render.
For more information, refer to the MSDoc1 and MSDoc2.
There are three main causes for the map showing a white screen:
div
has a size on the screen.To debug these issues further do the following:
div
and see if it takes up any screen space. If not, modify the CSS assigned to it to give it some dimensions. If you modify the div on the fly, the map may not appear still as it hasn’t triggered a rerender. You can callmap.resize()
to trigger a rerender of the map.