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/migrate-from-bing-maps-web-app.md
+12-27Lines changed: 12 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,12 +26,6 @@ Web apps that use Bing Maps often use the Bing Maps V8 JavaScript SDK. The Azure
26
26
> * Show traffic data
27
27
> * Add a ground overlay
28
28
29
-
If migrating an existing web application, check to see if it's using an open-source map control library such as Cesium, Leaflet, and OpenLayers. In such case, connect your application to the Azure Maps [Render] services ([road tiles] | [satellite tiles]). The following links provide details on how to use Azure Maps in commonly used open-source map control libraries.
30
-
31
-
*[Cesium] - A 3D map control for the web. <!--[Cesium code samples] \|-->[Cesium plugin]
32
-
*[Leaflet] – Lightweight 2D map control for the web. [Leaflet code samples]\|[Leaflet plugin]
33
-
*[OpenLayers] - A 2D map control for the web that supports projections. <!--[OpenLayers code samples] \|-->[OpenLayers plugin]
34
-
35
29
If developing using a JavaScript framework, one of the following open-source projects can be useful:
36
30
37
31
*[ng-azure-maps] - Angular 10 wrapper around Azure maps.
@@ -60,15 +54,15 @@ The following table lists key API features in the Bing Maps V8 JavaScript SDK an
60
54
| Tile Layers | ✓ |
61
55
| KML Layer | ✓ |
62
56
| Contour layer |[Contour layer code samples]|
63
-
| Data binning layer |Included in the open-source Azure Maps [Gridded Data Source module]|
57
+
| Data binning layer | N/A |
64
58
| Animated tile layer | Included in the open-source Azure Maps [Animation module]|
65
59
| Drawing tools | ✓ |
66
60
| Geocoder service | ✓ |
67
61
| Directions service | ✓ |
68
62
| Distance Matrix service | ✓ |
69
63
| Spatial Data service | N/A |
70
64
| Satellite/Aerial imagery | ✓ |
71
-
| Birds eye imagery | N/A |
65
+
| Birds eye imagery | N/A|
72
66
| Streetside imagery | N/A |
73
67
| GeoJSON support | ✓ |
74
68
| GeoXML support | ✓ [Spatial IO module]|
@@ -130,7 +124,7 @@ Loading a map in both SDKs follows the same set of steps;
130
124
131
125
* Add a reference to the Map SDK.
132
126
* Add a `div` tag to the body of the page that acts as a placeholder for the map.
133
-
* Create a JavaScript function that gets called when the page has loaded.
127
+
* Create a JavaScript function that gets called once the page loads.
134
128
* Create an instance of the respective map class.
135
129
136
130
**Key differences**
@@ -141,7 +135,7 @@ Loading a map in both SDKs follows the same set of steps;
141
135
* Coordinates in Azure Maps are defined as Position objects that can be specified as a simple number array in the format `[longitude, latitude]`.
142
136
* The zoom level in Azure Maps is one level lower than the Bing Maps example due to the difference in tiling system sizes between the platforms.
143
137
* By default, Azure Maps doesn’t add any navigation controls to the map canvas, such as zoom buttons and map style buttons. There are however controls for adding a map style picker, zoom buttons, compass or rotation control, and a pitch control.
144
-
* An event handler is added in Azure Maps to monitor the `ready` event of the map instance. This fires when the map has finished loading the WebGL context and all resources needed. Any post load code can be added in this event handler.
138
+
* An event handler is added in Azure Maps to monitor the `ready` event of the map instance. This fires when the map finishes loading the WebGL context and all resources needed. Any post load code can be added in this event handler.
145
139
146
140
The following examples demonstrate loading a basic map centered over New York at coordinates (longitude: -73.985, latitude: 40.747) and is at zoom level 12 in Bing Maps.
147
141
@@ -345,7 +339,7 @@ In Azure Maps, there are multiple ways that point data can be rendered on the ma
345
339
* Symbol Layer – Renders points with an icon and/or text within the WebGL context.
346
340
* Bubble Layer – Renders points as circles on the map. The radii of the circles can be scaled based on properties in the data.
347
341
348
-
Both Symbol and Bubble layers are rendered within the WebGL context and are capable of rendering large sets of points on the map. These layers require data to be stored in a data source. Data sources and rendering layers should be added to the map after the `ready` event has fired. HTML Markers are rendered as DOM elements within the page and don’t use a data source. The more DOM elements a page has, the slower the page becomes. If rendering more than a few hundred points on a map, it's recommended to use one of the rendering layers instead.
342
+
Both Symbol and Bubble layers are rendered within the WebGL context and are capable of rendering large sets of points on the map. These layers require data to be stored in a data source. Data sources and rendering layers should be added to the map after the `ready` event fires. HTML Markers are rendered as DOM elements within the page and don’t use a data source. The more DOM elements a page has, the slower the page becomes. If rendering more than a few hundred points on a map, try using one of the rendering layers instead.
349
343
350
344
The following examples add a marker to the map at (longitude: -0.2, latitude: 51.5) with the number 10 overlaid as a label.
351
345
@@ -365,7 +359,7 @@ layer.add(pushpin);
365
359
map.layers.insert(layer);
366
360
```
367
361
368
-
The second is to add it using the map’s `entities` property. This function is marked deprecated in the documentation for Bing Maps V8 however it has remained partially functional for basic scenarios.
362
+
The second is to add it using the map’s `entities` property. This function is marked deprecated in the documentation for Bing Maps V8 however it remains partially functional for basic scenarios.
369
363
370
364
```javascript
371
365
var pushpin =newMicrosoft.Maps.Pushpin(newMicrosoft.Maps.Location(51.5, -0.2), {
When using a Symbol layer, the data must be added to a data source, and the data source attached to the layer. Additionally, the data source and layer should be added to the map after the `ready` event has fired. To render a unique text value above a symbol, the text information needs to be stored as a property of the data point and that property referenced in the `textField` option of the layer. This is a bit more work than using HTML markers but provides performance advantages.
390
+
When using a Symbol layer, the data must be added to a data source, and the data source attached to the layer. Additionally, the data source and layer should be added to the map after the `ready` event fires. To render a unique text value above a symbol, the text information needs to be stored as a property of the data point and that property referenced in the `textField` option of the layer. This is a bit more work than using HTML markers but provides performance advantages.
397
391
398
392
```html
399
393
<!DOCTYPE html>
@@ -623,7 +617,7 @@ map.layers.insert(layer);
623
617
624
618
**After: Azure Maps**
625
619
626
-
In Azure Maps, polylines are referred to the more commonly geospatial terms `LineString` or `MultiLineString` objects. These objects can be added to a data source and rendered using a line layer. The stroke color, width and dash array options are nearly identical between the platforms.
620
+
In Azure Maps, polylines are referred to the more commonly geospatial terms `LineString` or `MultiLineString` objects. These objects can be added to a data source and rendered using a line layer. The stroke color, width, and dash array options are nearly identical between the platforms.
627
621
628
622
```javascript
629
623
//Get the center of the map.
@@ -921,7 +915,7 @@ The `DataSource` class has the following helper function for accessing additiona
921
915
|`getClusterExpansionZoom(clusterId: number)`|`Promise<number>`| Calculates a zoom level that the cluster starts expanding or break apart. |
922
916
|`getClusterLeaves(clusterId: number, limit: number, offset: number)`| `Promise<Feature<Geometry, any> | Shape>` | Retrieves all points in a cluster. Set the `limit` to return a subset of the points and use the `offset` to page through the points. |
923
917
924
-
When rendering clustered data on the map, it's often easiest to use two or more layers. The following example uses three layers, a bubble layer for drawing scaled colored circles based on the size of the clusters, a symbol layer to render the cluster size as text, and a second symbol layer for rendering the unclustered points. For more information on rendering clustered data in Azure Maps, see [Clustering point data in the Web SDK]
918
+
When rendering clustered data on the map, it's often easiest to use two or more layers. The following example uses three layers, a bubble layer for drawing scaled colored circles based on the size of the clusters, a symbol layer to render the cluster size as text, and a second symbol layer for rendering the unclustered points. For more information on rendering clustered data in Azure Maps, see [Clustering point data in the Web SDK].
925
919
926
920
GeoJSON data can be directly imported in Azure Maps using the `importDataFromUrl` function on the `DataSource` class.
In Azure Maps, a tile layer can be added to the map in much the same way as any other layer. A formatted URL that has in x, y, zoom placeholders; `{x}`, `{y}`, `{z}` respectively is used to tell the layer where to access the tiles. Azure Maps tile layers also support `{quadkey}`, `{bbox-epsg-3857}` and `{subdomain}` placeholders.
1176
+
In Azure Maps, a tile layer can be added to the map in much the same way as any other layer. A formatted URL that has in x, y, zoom placeholders; `{x}`, `{y}`, `{z}` respectively is used to tell the layer where to access the tiles. Azure Maps tile layers also support `{quadkey}`, `{bbox-epsg-3857}`, and `{subdomain}` placeholders.
1183
1177
1184
1178
> [!TIP]
1185
1179
> In Azure Maps, layers can be rendered below other layers, including base map layers. Often it is desirable to render tile layers below the map labels so that they are easy to read. The `map.layers.add` function takes in a second parameter that is the ID of a second layer to insert the new layer below. To insert a tile layer below the map labels the following code can be used:
@@ -1248,7 +1242,7 @@ If you select one of the traffic icons in Azure Maps, more information displays
1248
1242
1249
1243
### Add a ground overlay
1250
1244
1251
-
Both Bing and Azure maps support overlaying georeferenced images on the map that they move and scale as you pan and zoom the map. In Bing Maps these are known as ground overlays, in Azure Maps they're referred to as image layers. image layers are great for building floor plans, overlaying old maps, or imagery from a drone.
1245
+
Both Bing and Azure maps support overlaying georeferenced images on the map that they move and scale as you pan and zoom the map. In Bing Maps these are known as ground overlays, in Azure Maps they're referred to as image layers. Image layers are great for building floor plans, overlaying old maps, or imagery from a drone.
1252
1246
1253
1247
**Before: Bing Maps**
1254
1248
@@ -1571,7 +1565,7 @@ In Bing Maps the `DrawingTools` module is loaded using the `Microsoft.Maps.loadM
1571
1565
1572
1566
**After: Azure Maps**
1573
1567
1574
-
In Azure Maps, the drawing tools module needs to be loaded by loading the JavaScript and CSS files need to be referenced in the app. Once the map has loaded, an instance of the `DrawingManager` class can be created and a `DrawingToolbar` instance attached.
1568
+
In Azure Maps, the drawing tools module needs to be loaded by loading the JavaScript and CSS files need to be referenced in the app. Once the map is loaded, an instance of the `DrawingManager` class can be created and a `DrawingToolbar` instance attached.
1575
1569
1576
1570
```html
1577
1571
<!DOCTYPE html>
@@ -1643,14 +1637,8 @@ Review code samples related migrating other Bing Maps features:
0 commit comments