In a React project (CRA), Azure Map external standalone scripts (e.g. azure-maps-geolocation-control.js) cannot read/merge with the namespace of Azure Map SDK (e.g. azure-maps-control) in a React component.

Joanne 0 Reputation points
2024-05-16T01:56:55.0833333+00:00

I am working with a CRA React project. In a React component, I have tried to import and load an external Azure Map standalone script like azure-maps-geolocation-control which adds on to the Azure Map namespace (atlas). In this component I have imported Azure Map SDK like azure-maps-control which works fine to render the map and supplies the namespace.

Under map ready event, I have tried to instantiate GeolocationControl object but seems like the script cannot read the atlas namespace. This external script is placed in public folder and dynamically placed in <head> of index.html .

How to make the script link to Azure Map SDK namespace, in a React component? Thank you

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
615 questions
0 comments No comments
{count} votes