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-map-control.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,23 +22,23 @@ You can embed a map in a web page by using the Map Control client-side JavaScrip
22
22
23
23
2. Load in the Azure Maps Web SDK. You can choose one of two options;
24
24
25
-
a. Use the globally hosted CDN version of the Azure Maps Web SDK by adding references to the JavaScript and stylesheet in the `<head>` element of the HTML file:
25
+
* Use the globally hosted CDN version of the Azure Maps Web SDK by adding references to the JavaScript and stylesheet in the `<head>` element of the HTML file:
1. Load the Azure Maps Web SDK source code locally using the [azure-maps-control](https://www.npmjs.com/package/azure-maps-control) NPM package and host it with your app. This package also includes TypeScript definitions.
32
+
* Load the Azure Maps Web SDK source code locally using the [azure-maps-control](https://www.npmjs.com/package/azure-maps-control) NPM package and host it with your app. This package also includes TypeScript definitions.
33
33
34
-
> **npm install azure-maps-control**
34
+
> **npm install azure-maps-control**
35
35
36
-
Then add references to the Azure Maps stylesheet and script source references to the `<head>` element of the file:
36
+
Then add references to the Azure Maps stylesheet and script source references to the `<head>` element of the file:
#Customer intent: As an Azure Maps web sdk user, I want to install and use the spatial io module so that I can integrate spatial data with the Azure Maps web sdk.
12
12
---
13
13
14
-
15
14
# How to use the Azure Maps Spatial IO module
16
15
17
16
The Azure Maps Web SDK provides the **Spatial IO module**, which integrates spatial data with the Azure Maps web SDK using JavaScript or TypeScript. The robust features in this module allow developers to:
@@ -32,190 +31,190 @@ Before you can use the Spatial IO module, you'll need to [make an Azure Maps acc
32
31
33
32
You can load the Azure Maps spatial IO module using one of the two options:
34
33
35
-
a. The globally hosted Azure CDN for the Azure Maps spatial IO module. For this option, you add a reference to the JavaScript in the `<head>` element of the HTML file.
34
+
* The globally hosted Azure CDN for the Azure Maps spatial IO module. For this option, you add a reference to the JavaScript in the `<head>` element of the HTML file.
b. The source code for [azure-maps-spatial-io](https://www.npmjs.com/package/azure-maps-spatial-io) can be loaded locally, and then hosted with your app. This package also includes TypeScript definitions. For this option, use the following command to install the package:
40
+
* The source code for [azure-maps-spatial-io](https://www.npmjs.com/package/azure-maps-spatial-io) can be loaded locally, and then hosted with your app. This package also includes TypeScript definitions. For this option, use the following command to install the package:
42
41
43
-
```sh
44
-
npm install azure-maps-spatial-io
45
-
```
42
+
```sh
43
+
npm install azure-maps-spatial-io
44
+
```
46
45
47
-
Then, add a reference to the JavaScript in the `<head>` element of the HTML document:
46
+
Then, add a reference to the JavaScript in the `<head>` element of the HTML document:
2. Load the Azure Maps Web SDK and initialize the map control. See the [Azure Maps map control](https://docs.microsoft.com/azure/azure-maps/how-to-use-map-control) guide for the details. Once you're done with this step, your HTML file should look like this:
58
57
59
-
```html
60
-
<!DOCTYPE html>
61
-
<html>
58
+
```html
59
+
<!DOCTYPE html>
60
+
<html>
62
61
63
-
<head>
64
-
<title></title>
62
+
<head>
63
+
<title></title>
65
64
66
-
<metacharset="utf-8">
65
+
<metacharset="utf-8">
67
66
68
-
<!-- Ensures that IE and Edge uses the latest version and doesn't emulate an older version -->
//Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at https://azure.com/maps
88
-
authOptions: {
89
-
authType:'subscriptionKey',
90
-
subscriptionKey:'<Your Azure Maps Key>'
91
-
}
92
-
});
81
+
functionGetMap() {
82
+
//Initialize a map instance.
83
+
map =newatlas.Map('myMap', {
84
+
view:'Auto',
85
+
86
+
//Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at https://azure.com/maps
87
+
authOptions: {
88
+
authType:'subscriptionKey',
89
+
subscriptionKey:'<Your Azure Maps Key>'
90
+
}
91
+
});
93
92
94
-
//Wait until the map resources are ready.
95
-
map.events.add('ready', function() {
93
+
//Wait until the map resources are ready.
94
+
map.events.add('ready', function() {
96
95
97
-
// Write your code here to make sure it runs once the map resources are ready
96
+
// Write your code here to make sure it runs once the map resources are ready
98
97
99
-
});
100
-
}
101
-
</script>
102
-
</head>
98
+
});
99
+
}
100
+
</script>
101
+
</head>
103
102
104
-
<bodyonload="GetMap()">
105
-
<divid="myMap"></div>
106
-
</body>
103
+
<bodyonload="GetMap()">
104
+
<divid="myMap"></div>
105
+
</body>
107
106
108
-
</html>
109
-
```
107
+
</html>
108
+
```
110
109
111
110
2. Load the Azure Maps spatial IO module. For this exercise, use the CDN for the Azure Maps spatial IO module. Add the reference below to the the `<head>` element of your HTML file:
3. Initialize a `datasource`, and add the data source to the map. Initialize a `layer`, and add the data source to the map layer. Then, render both the data source and the layer. Before you scroll down to see the full code in the next step, think about the best places to put the data source and layer code snippets. Recall that, before we programmatically manipulate the map, we should wait until the map resource are ready.
layer = new atlas.layer.SimpleDataLayer(datasource);
131
+
map.layers.add(layer);
132
+
```
134
133
135
134
4. Putting it all together, your HTML code should look like the following code. This sample demonstrates how to read an XML file from a URL. Then, load and display the file's feature data on the map.
136
135
137
-
```html
138
-
<!DOCTYPE html>
139
-
<html>
136
+
```html
137
+
<!DOCTYPE html>
138
+
<html>
140
139
141
-
<head>
142
-
<title>Spatial IO Module Example</title>
140
+
<head>
141
+
<title>Spatial IO Module Example</title>
143
142
144
-
<metacharset="utf-8">
143
+
<metacharset="utf-8">
145
144
146
-
<!-- Ensures that IE and Edge uses the latest version and doesn't emulate an older version -->
Copy file name to clipboardExpand all lines: articles/azure-maps/spatial-io-add-ogc-map-layer.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,11 +23,11 @@ The following sections outline the Web Mapping Service features that are support
23
23
- GetFeatureInfo requires the service to support `EPSG:4326` or handle reprojections.
24
24
- Supported operations:
25
25
26
-
|||
27
-
| :-- | :-- |
28
-
| GetCapabilities | Retrieves metadata about the service with the supported capabilities |
29
-
| GetMap | Retrieves a map image for a specified region |
30
-
| GetFeatureInfo | Retrieves `feature_info`, which contains underlying data about the feature |
26
+
|||
27
+
| :-- | :-- |
28
+
| GetCapabilities | Retrieves metadata about the service with the supported capabilities |
29
+
| GetMap | Retrieves a map image for a specified region |
30
+
| GetFeatureInfo | Retrieves `feature_info`, which contains underlying data about the feature |
31
31
32
32
**Web Mapping Tile Service (WMTS)**
33
33
@@ -37,10 +37,10 @@ The following sections outline the Web Mapping Service features that are support
37
37
- TileMatrix identifier must be an integer value that corresponds to a zoom level on the map. On an azure map, the zoom level is a value between `"0"` and `"22"`. So, `"0"` is supported, but `"00"` isn't supported.
38
38
- Supported operations:
39
39
40
-
|||
41
-
| :-- | :-- |
42
-
| GetCapabilities | Retrieves the supported operations and features |
43
-
| GetTile | Retrieves imagery for a particular tile |
40
+
|||
41
+
| :-- | :-- |
42
+
| GetCapabilities | Retrieves the supported operations and features |
43
+
| GetTile | Retrieves imagery for a particular tile |
0 commit comments