Closed KallumTanton closed 5 years ago
@KallumTanton Thank you very much for the feedback on this. I have assigned this to the content owner to make an enhancement to the .js sample found in the tutorial.
@KallumTanton - I tried a few examples and could not reproduce the error using your or the supplied example code in either of the two articles:
1. https://docs.microsoft.com/en-us/azure/azure-maps/map-create.
2. https://docs.microsoft.com/en-us/azure/azure-maps/how-to-use-map-control
It seems the real culprit has less to do with initialization and more to do with loading two of the same dependencies (or slightly different versions of the same dependencies) within your app? If so, that's mostly a dependency and architectural situation. Have you tried removing one of those dependencies and seeing if it works?
Please review the examples above and let us know if you run into additional issues!
We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.
@sergaz-msft I have an example of a simple HTML page if insert these scripts after AppInsight code it breaks the map
<link href="https://atlas.microsoft.com/sdk/css/atlas.min.css?api-version=1" rel="stylesheet" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/js/atlas.min.js?api-version=1"></script>
If insert them before AppInsight script - it is OK.
I have the same issue, but I don't want to load this scripts in the head - it is blocking operation and atlas.min.js load near 2 sec. That is not applicable to my application to wait 2 sec for map if I use SPA and don't use map on the main page.
I tried to load the atlas.min.js via scriptjs
library asynchronously. But it fails with applicationinsights_js_1.AppInsights.downloadAndSetup is not a function
btw, appinsights scripts are loaded in the head.
Please, reopen this issue or provide the workaround for this case.
@dsk-2015 @KingdomOfEnds can you take a look? Thanks!
@sergaz-msft - This has been directed to the current document maintainers. Thanks!
Thanks @KingdomOfEnds please let us know when the issue is addressed.
@haywoodsloan just came across this issue on GitHub, do you know if this is something we have addressed already?
Yes, as of version 2.0.2 the map control sdk no longer relies on a global AppInsights instance. Now pages can use AppInsights via the downloadAndSetup method alongside the map control.
Great, thanks Sloan. Admins, can we close this issue now as it is fixed in the latest version of Azure Maps.
I'm attempting to use the Azure Maps Javascript control by using the simple instructions in this article.
Both the script (atlas.min.js) and the styles (atlas.min.css) are retrieved fine however, when I create a new map I receive the following error:
The application this is being used in already has its own AppInsights initialisation in the header, long before this JS if ever executed. According to this issue "The call to downloadAndSetup can fail if the SDK is already downloaded and initialized". The solution then is simply to check if the function "downloadAndSetup" exists before calling it. That's fine, but "atlas.min.js" doesn't perform this check and always executes this function regardless of its availability.
My code:
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.