You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-maps/how-to-use-services-module.md
+75-74Lines changed: 75 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Using the Services module - Azure Maps | Microsoft Docs
2
+
title: Use the services module - Azure Maps | Microsoft Docs
3
3
description: Learn how to use the Azure Maps services module.
4
4
author: rbrundritt
5
5
ms.author: richbrun
@@ -10,88 +10,89 @@ services: azure-maps
10
10
manager: cpendleton
11
11
---
12
12
13
-
# Using the Azure Maps Services module
13
+
# Use the Azure Maps services module
14
14
15
-
The Azure Maps Web SDK provides a services module that is a helper library that makes it easy to use the Azure Maps REST services in web or Node.js applications using JavaScript or TypeScript.
15
+
The Azure Maps Web SDK provides a *services module*. This module is a helper library that makes it easy to use the Azure Maps REST services in web or Node.js applications by using JavaScript or TypeScript.
16
16
17
-
## Using the services module in a web page
17
+
## Use the services module in a webpage
18
18
19
19
1. Create a new HTML file.
20
-
2. Load in the Azure Maps Services module. This can be done using one of two options;
20
+
1. Load the Azure Maps services module. You can load it in one of two ways:
21
+
- Use the globally hosted, Azure Content Delivery Network version of the Azure Maps services module. Add a script reference to the `<head>` element of the file:
21
22
22
-
a. Use the globally hosted CDN version of the Azure Maps services module by adding a script reference to the `<head>` element of the file:
b. Alternatively, load the Azure Maps Web SDK source code locally using the [azure-maps-rest](https://www.npmjs.com/package/azure-maps-rest) NPM package and host it with your app. This package also includes TypeScript definitions.
- Alternatively, load the Azure Maps Web SDK source code locally by using the [azure-maps-rest](https://www.npmjs.com/package/azure-maps-rest) npm package, and then host it with your app. This package also includes TypeScript definitions. Use this command:
31
28
32
-
Then add a script reference to the `<head>` element of the file:
Then, add a script reference to the `<head>` element of the file:
37
32
38
-
3. To initialize a service URL client endpoint, you must first create an authentication pipeline. Use your own Azure Maps account key or Azure Active Directory (AAD) credentials to authenticate the search service client. In this example, the search service URL client will be created. If using a subscription key for authentication:
1. Create an authentication pipeline. You must create the pipeline before you can initialize a service URL client endpoint. Use your own Azure Maps account key or Azure Active Directory (Azure AD) credentials to authenticate an Azure Maps Search service client. In this example, the Search service URL client will be created.
38
+
39
+
If you use a subscription key for authentication:
39
40
40
41
```javascript
41
-
//Get an Azure Maps key at https://azure.com/maps
42
+
//Get an Azure Maps key at https://azure.com/maps.
42
43
var subscriptionKey = '<YourAzureMapsKey>';
43
-
44
-
//Use SubscriptionKeyCredential with a subscription key.
44
+
45
+
//Use SubscriptionKeyCredential with a subscription key.
45
46
var subscriptionKeyCredential = new atlas.service.SubscriptionKeyCredential(subscriptionKey);
46
-
47
-
//Use subscriptionKeyCredential to create a pipeline.
47
+
48
+
//Use subscriptionKeyCredential to create a pipeline.
48
49
var pipeline = atlas.service.MapsURL.newPipeline(subscriptionKeyCredential, {
49
50
retryOptions: { maxTries: 4 } // Retry options
50
51
});
51
-
52
-
//Create an instance of the SearchURL client.
52
+
53
+
//Create an instance of the SearchURL client.
53
54
var searchURL = new atlas.service.SearchURL(pipeline);
54
55
```
55
-
56
-
If using Azure Active Directory (AAD)for authentication:
56
+
57
+
If you use Azure AD for authentication:
57
58
58
59
```javascript
59
-
// Enter your Azure Actiuve Directory client ID.
60
+
// Enter your Azure AD client ID.
60
61
var clientId = "<YourAzureActiveDirectoryClientId>";
61
-
62
-
// Use TokenCredential with OAuth token (AAD or Anonymous).
62
+
63
+
// Use TokenCredential with OAuth token (Azure AD or Anonymous).
63
64
var aadToken = await getAadToken();
64
65
var tokenCredential = new atlas.service.TokenCredential(clientId, aadToken);
65
-
66
-
// Create a repeating timeout that will renew the AAD token.
67
-
// This timeout must be cleared once the TokenCredential object is no longer needed.
68
-
// If the timeout is not cleared the memory used by the TokenCredential will never be reclaimed.
66
+
67
+
// Create a repeating time-out that will renew the Azure AD token.
68
+
// This time-out must be cleared when the TokenCredential object is no longer needed.
69
+
// If the time-out is not cleared, the memory used by the TokenCredential will never be reclaimed.
For more information, see [Authentication with Azure Maps](azure-maps-authentication.md).
120
121
121
-
4. The following code uses the newly created search service URL client to geocode an address,"1 Microsoft Way, Redmond, WA" using the `searchAddress`function and display the results as a table in the body of the page.
122
+
1. The following code uses the newly created Azure Search service URL client to geocode an address: "1 Microsoft Way, Redmond, WA". The code uses the `searchAddress` function and displays the results as a table in the body of the page.
122
123
123
124
```javascript
124
-
//Search for "1 microsoft way, redmond, wa".
125
+
//Search for "1 microsoft way, redmond, wa".
125
126
searchURL.searchAddress(atlas.service.Aborter.timeout(10000), '1 microsoft way, redmond, wa').then(response => {
Copy file name to clipboardExpand all lines: articles/azure-maps/supported-browsers.md
+19-18Lines changed: 19 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,43 +12,43 @@ manager: cpendleton
12
12
13
13
# Web SDK supported browsers
14
14
15
-
The Azure Maps Web SDK provides a helper function [atlas.isSupported](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas?view=azure-iot-typescript-latest#issupported-boolean-) to detect if a web browser has the minimum required WebGL features to support loading and rendering the map control.
15
+
The Azure Maps Web SDK provides a helper function called [atlas.isSupported](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas?view=azure-iot-typescript-latest#issupported-boolean-). This function detects whether a web browser has the minimum set of WebGL features required to support loading and rendering the map control. Here's an example of how to use the function:
16
16
17
17
```
18
18
if(!atlas.isSupported()) {
19
19
alert('Your browser is not supported by Azure Maps');
20
20
} else if(!atlas.isSupported(true)) {
21
21
alert('Your browser is supported by Azure Maps, but may have major performance caveats.');
22
22
} else {
23
-
//Your browser is supported. Add your map code here.
23
+
//Your browser is supported. Add your map code here.
24
24
}
25
25
```
26
26
27
27
## Desktop
28
28
29
-
The Azure Maps Web SDK supports the following desktop browsers.
29
+
The Azure Maps Web SDK supports the following desktop browsers:
30
30
31
-
-The current and previous version of Microsoft Edge
32
-
-The current and previous version of Chrome
33
-
-The current and previous version of Firefox
34
-
-The current and previous version of Safari (Mac OS X)
31
+
-Microsoft Edge (current and previous version)
32
+
-Google Chrome (current and previous version)
33
+
-Mozilla Firefox (current and previous version)
34
+
-Apple Safari (Mac OS X) (current and previous version)
35
35
36
-
See also [Target legacy browsers](#Target-Legacy-Browsers).
36
+
See also [Target legacy browsers](#Target-Legacy-Browsers) later in this article.
37
37
38
38
## Mobile
39
39
40
-
The Azure Maps Web SDK supports the following mobile browsers.
40
+
The Azure Maps Web SDK supports the following mobile browsers:
41
41
42
-
-Android
43
-
*Current version of Chrome on Android 6.0+
44
-
*Chrome WebView on Android 6.0+
42
+
- Android
43
+
-Current version of Chrome on Android 6.0 and later
44
+
-Chrome WebView on Android 6.0 and later
45
45
- iOS
46
-
* Mobile Safari on the current and previous major version of iOS
47
-
* UIWebView and WKWebView on the current and previous major version of iOS
48
-
* Current version of Chrome for iOS
46
+
- Mobile Safari on the current and previous major version of iOS
47
+
- UIWebView and WKWebView on the current and previous major version of iOS
48
+
- Current version of Chrome for iOS
49
49
50
50
> [!TIP]
51
-
> If you are embedding a map inside a mobile application using a WebView control, you may prefer using the [npm package of the Azure Maps Web SDK](https://www.npmjs.com/package/azure-maps-control) instead of referencing the CDN hosted version of the SDK. This will reduce loading time as the SDK will already be on the user's device and not need to be downloaded at runtime.
51
+
> If you're embedding a map inside a mobile application by using a WebView control, you might prefer to use the [npm package of the Azure Maps Web SDK](https://www.npmjs.com/package/azure-maps-control) instead of referencing the version of the SDK that's hosted on Azure Content Delivery Network. This approach reduces loading time because the SDK is already be on the user's device and doesn't need to be downloaded at run time.
52
52
53
53
## Node.js
54
54
@@ -58,8 +58,9 @@ The following Web SDK modules are also supported in Node.js:
If you need to target older browsers that may not support or have limited support for WebGL, it is recommended to use the Azure Maps Services in combination with an open-source map control such as [leaflet](https://leafletjs.com/).
61
+
You might want to target older browsers that don't support WebGL or that have only limited support for it. In such cases, we recommend that you use Azure Maps services together with an open-source map control like [Leaflet](https://leafletjs.com/). Here's an example:
0 commit comments