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
+
1. 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.
1. 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
-
var clientId = "<Your Azure Active Directory Client Id>";
61
-
62
-
// Use TokenCredential with OAuth token (AAD or Anonymous).
60
+
// Enter your Azure AD client ID.
61
+
var clientId = "<YourAzureActiveDirectoryclientID>";
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
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ 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 [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.
0 commit comments