Skip to content

Commit 4cdcd75

Browse files
authored
Merge pull request #108485 from rbrundritt/master
Minor updates
2 parents 71aa4f4 + 660e25e commit 4cdcd75

File tree

3 files changed

+92
-70
lines changed

3 files changed

+92
-70
lines changed

articles/azure-maps/how-to-use-spatial-io-module.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ manager: philmea
1515

1616
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:
1717

18-
- [Read and write data to common spatial files](spatial-io-read-write-spatial-data.md). Supported file formats include: KML, KMZ, GPX, GeoRSS, GML, and CSV files containing columns with spatial information. Also supports Well-Known Text (WKT).
19-
- [Connect to Open Geospatial Consortium (OGC) services and integrate with Azure Maps web SDK. Overlay Web Map Services (WMS) and Web Map Tile Services (WMTS) as layers on the map.](spatial-io-add-ogc-map-layer.md).
18+
- [Read and write common spatial data files](spatial-io-read-write-spatial-data.md). Supported file formats include: KML, KMZ, GPX, GeoRSS, GML, GeoJSON and CSV files containing columns with spatial information. Also supports Well-Known Text (WKT).
19+
- [Connect to Open Geospatial Consortium (OGC) services and integrate with Azure Maps web SDK. Overlay Web Map Services (WMS) and Web Map Tile Services (WMTS) as layers on the map](spatial-io-add-ogc-map-layer.md).
2020
- [Query data in a Web Feature Service (WFS)](spatial-io-connect-wfs-service.md).
21-
- [Overlay complex data sets that contain style information and have them render automatically](spatial-io-add-simple-data-layer.md).
21+
- [Overlay complex data sets that contain style information and have them render automatically using minimal code](spatial-io-add-simple-data-layer.md).
2222
- [Leverage high-speed XML and delimited file reader and writer classes](spatial-io-core-operations.md).
2323

2424
In this guide, we'll learn how to integrate and use the Spatial IO module in a web application.

articles/azure-maps/map-add-popup.md

Lines changed: 87 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This article shows you how to add a popup to a point on a map.
1717

1818
## Understand the code
1919

20-
The following code adds a point feature, that has `name` and `description` properties, to the map using a symbol layer. An instance of the [Popup class](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popup?view=azure-iot-typescript-latest) is created but not displayed. Mouse events are added to the symbol layer to trigger opening and closing the popup. When the marker symbol is hovered, the popup's `position` property is updated with position of the marker, and the `content` option is updated with some HTML that wraps the `name` and `description` properties of the point feature being hovered. The popup is then displayed on the map using its `open` function.
20+
The following code adds a point feature, that has `name` and `description` properties, to the map using a symbol layer. An instance of the [Popup class](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popup) is created but not displayed. Mouse events are added to the symbol layer to trigger opening and closing the popup. When the marker symbol is hovered, the popup's `position` property is updated with position of the marker, and the `content` option is updated with some HTML that wraps the `name` and `description` properties of the point feature being hovered. The popup is then displayed on the map using its `open` function.
2121

2222
```javascript
2323
//Define an HTML template for a custom popup content laypout.
@@ -120,20 +120,26 @@ The `numberFormat` option specifies the format of the number to display. If the
120120
> There's only one way in which the String template can render images. First, the String template needs to have an image tag in it. The value being passed to the image tag should be a URL to an image. Then, the String template needs to have `isImage` set to true in the `HyperLinkFormatOptions`. The `isImage` option specifies that the hyperlink is for an image, and the hyperlink will be loaded into an image tag. When the hyperlink is clicked, the image will open.
121121
122122
```javascript
123-
new atlas.data.Feature(new atlas.data.Point([-20, -20]), {
123+
var templateOptions = {
124+
content: 'This template uses a string template with placeholders.<br/><br/> - Value 1 = {value1}<br/> - Value 2 = {value2/subValue}<br/> - Array value [2] = {arrayValue/2}',
125+
numberFormat: {
126+
maximumFractionDigits: 2
127+
}
128+
};
129+
130+
var feature = new atlas.data.Feature(new atlas.data.Point([0, 0]), {
124131
title: 'Template 1 - String template',
125132
value1: 1.2345678,
126133
value2: {
127134
subValue: 'Pizza'
128135
},
129-
arrayValue: [3, 4, 5, 6],
130-
popupTemplate: {
131-
content: 'This template uses a string template with placeholders.<br/><br/> - Value 1 = {value1}<br/> - Value 2 = {value2/subValue}<br/> - Array value [2] = {arrayValue/2}',
132-
numberFormat: {
133-
maximumFractionDigits: 2
134-
}
135-
}
136-
}),
136+
arrayValue: [3, 4, 5, 6]
137+
});
138+
139+
var popup = new atlas.Popup({
140+
content: atlas.PopupTemplate.applyTemplate(feature.properties, templateOptions),
141+
position: feature.geometry.coordinates
142+
});
137143
```
138144

139145
### PropertyInfo template
@@ -143,84 +149,95 @@ The PropertyInfo template displays available properties of the feature. The `lab
143149
Before the PropertyInfo template display the properties to the end user, it recursively checks that the properties are indeed defined for that feature. It also ignores displaying style and title properties. For example, it won't display `color`, `size`, `anchor`, `strokeOpacity`, and `visibility`. So, once property path checking is complete in the back-end, the PropertyInfo template shows the content in a table format.
144150

145151
```javascript
146-
new atlas.data.Feature(new atlas.data.Point([20, -20]), {
147-
title: 'Template 2 - PropertyInfo',
148-
createDate: new Date(),
149-
dateNumber: 1569880860542,
150-
url: 'https://aka.ms/AzureMapsSamples',
151-
152-
popupTemplate: {
153-
content: [{
154-
propertyPath: 'createDate',
155-
label: 'Created Date'
152+
var templateOptions = {
153+
content: [
154+
{
155+
propertyPath: 'createDate',
156+
label: 'Created Date'
156157
},
157158
{
158-
propertyPath: 'dateNumber',
159-
label: 'Formatted date from number',
160-
dateFormat: {
161-
weekday: 'long',
162-
year: 'numeric',
163-
month: 'long',
164-
day: 'numeric',
165-
timeZone: 'UTC',
166-
timeZoneName: 'short'
167-
}
159+
propertyPath: 'dateNumber',
160+
label: 'Formatted date from number',
161+
dateFormat: {
162+
weekday: 'long',
163+
year: 'numeric',
164+
month: 'long',
165+
day: 'numeric',
166+
timeZone: 'UTC',
167+
timeZoneName: 'short'
168+
}
168169
},
169170
{
170-
propertyPath: 'url',
171-
label: 'Code samples',
172-
hideLabel: true,
173-
hyperlinkFormat: {
174-
lable: 'Go to code samples!',
175-
target: '_blank'
176-
}
171+
propertyPath: 'url',
172+
label: 'Code samples',
173+
hideLabel: true,
174+
hyperlinkFormat: {
175+
lable: 'Go to code samples!',
176+
target: '_blank'
177+
}
177178
},
178179
{
179-
propertyPath: 'email',
180-
label: 'Email us',
181-
hideLabel: true,
182-
hyperlinkFormat: {
183-
target: '_blank',
184-
scheme: 'mailto:'
180+
propertyPath: 'email',
181+
label: 'Email us',
182+
hideLabel: true,
183+
hyperlinkFormat: {
184+
target: '_blank',
185+
scheme: 'mailto:'
185186
}
186187
}
187-
]
188-
}
188+
]
189+
};
190+
191+
var feature = new atlas.data.Feature(new atlas.data.Point([0, 0]), {
192+
title: 'Template 2 - PropertyInfo',
193+
createDate: new Date(),
194+
dateNumber: 1569880860542,
195+
url: 'https://aka.ms/AzureMapsSamples',
196+
189197
}),
190198

199+
var popup = new atlas.Popup({
200+
content: atlas.PopupTemplate.applyTemplate(feature.properties, templateOptions),
201+
position: feature.geometry.coordinates
202+
});
191203
```
192204

193205
### Multiple content templates
194206

195207
A feature may also display content using a combination of the String template and the PropertyInfo template. In this case, the String template renders placeholders values on a white background. And, the PropertyInfo template renders a full width image inside a table. The properties in this sample are similar to the properties we explained in the previous samples.
196208

197209
```javascript
198-
new atlas.data.Feature(new atlas.data.Point([0, 0]), {
210+
var templateOptions = {
211+
content: [
212+
'This template has two pieces of content; a string template with placeholders and a array of property info which renders a full width image.<br/><br/> - Value 1 = {value1}<br/> - Value 2 = {value2/subValue}<br/> - Array value [2] = {arrayValue/2}',
213+
[{
214+
propertyPath: 'imageLink',
215+
label: 'Image',
216+
hideImageLabel: true,
217+
hyperlinkFormat: {
218+
isImage: true
219+
}
220+
}]
221+
],
222+
numberFormat: {
223+
maximumFractionDigits: 2
224+
}
225+
};
226+
227+
var feature = new atlas.data.Feature(new atlas.data.Point([0, 0]), {
199228
title: 'Template 3 - Multiple content template',
200229
value1: 1.2345678,
201230
value2: {
202231
subValue: 'Pizza'
203232
},
204233
arrayValue: [3, 4, 5, 6],
205-
imageLink: 'https://azuremapscodesamples.azurewebsites.net/common/images/Pike_Market.jpg',
206-
popupTemplate: {
207-
content: [
208-
'This template has two pieces of content; a string template with placeholders and a array of property info which renders a full width image.<br/><br/> - Value 1 = {value1}<br/> - Value 2 = {value2/subValue}<br/> - Array value [2] = {arrayValue/2}',
209-
[{
210-
propertyPath: 'imageLink',
211-
label: 'Image',
212-
hideImageLabel: true,
213-
hyperlinkFormat: {
214-
isImage: true
215-
}
216-
}]
217-
],
218-
numberFormat: {
219-
maximumFractionDigits: 2
220-
}
221-
}
222-
}),
223-
]);
234+
imageLink: 'https://azuremapscodesamples.azurewebsites.net/common/images/Pike_Market.jpg'
235+
});
236+
237+
var popup = new atlas.Popup({
238+
content: atlas.PopupTemplate.applyTemplate(feature.properties, templateOptions),
239+
position: feature.geometry.coordinates
240+
});
224241
```
225242

226243
### Points without a defined template
@@ -259,10 +276,13 @@ Popups can be opened, closed, and dragged. The popup class provides events to he
259276
Learn more about the classes and methods used in this article:
260277

261278
> [!div class="nextstepaction"]
262-
> [Popup](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popup?view=azure-iot-typescript-latest)
279+
> [Popup](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popup)
280+
281+
> [!div class="nextstepaction"]
282+
> [PopupOptions](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popupoptions)
263283
264284
> [!div class="nextstepaction"]
265-
> [PopupOptions](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popupoptions?view=azure-iot-typescript-latest)
285+
> [PopupTemplate](https://docs.microsoft.com/javascript/api/azure-maps-control/atlas.popuptemplate)
266286
267287
See the following great articles for full code samples:
268288

articles/azure-maps/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@
247247
href: https://docs.microsoft.com/javascript/api/azure-maps-drawing-tools/
248248
- name: Service module
249249
href: https://docs.microsoft.com/javascript/api/azure-maps-rest/
250+
- name: Spatial IO module
251+
href: https://docs.microsoft.com/javascript/api/azure-maps-spatial-io/
250252
- name: Resource Manager template
251253
href: /azure/templates/microsoft.maps/accounts
252254
- name: Resources

0 commit comments

Comments
 (0)