Skip to content

Commit a5102a4

Browse files
committed
icons
1 parent 4877223 commit a5102a4

4 files changed

Lines changed: 31 additions & 29 deletions

File tree

‎Samples/REST Services/MIO/mio.html‎

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
// Initialize a map instance.
5454
map = new atlas.Map('myMap', {
5555
center: [-105.076, 40.56],
56-
zoom: 11,
56+
zoom: 12,
5757
style: 'grayscale_light',
5858
view: 'Auto',
5959

@@ -76,7 +76,8 @@
7676
map.events.add('ready', function () {
7777

7878
// Load the custom image icon into the map resources.
79-
map.imageSprite.add('fire-shield-icon', '/images/icons/fire_shield.png');
79+
map.imageSprite.add('home-icon', '/images/icons/home.png');
80+
map.imageSprite.add('depot-icon', '/images/icons/factory.png');
8081

8182
// Download stop and depot location GeoJSON data.
8283
Promise.all([
@@ -104,38 +105,39 @@
104105

105106
// Add rendering layers below labels.
106107
map.layers.add([
107-
new atlas.layer.LineLayer(routeDataSource, null, {
108+
// Add a line layer for rendering the route.
109+
new atlas.layer.LineLayer(routeDataSource, 'routes', {
108110
strokeColor: ['get', 'strokeColor'],
109111
strokeWidth: 5,
110112
strokeOpacity: 0.8,
111113
lineJoin: 'round',
112114
lineCap: 'round'
113-
}),
114-
new atlas.layer.BubbleLayer(stopDataSource, null, {
115-
createIndicators: true, // to enable bubble layer a11y feature
116-
radius: 4,
117-
strokeWidth: 0
118115
})
119116
], 'labels');
120117

121-
// Render an icon for each depot.
122-
map.layers.add(new atlas.layer.SymbolLayer(depotDataSource, null, {
123-
iconOptions: {
124-
image: 'fire-shield-icon',
125-
size: 0.5,
126-
anchor: "center",
127-
allowOverlap: true,
128-
ignorePlacement: true
129-
},
130-
textOptions: {
131-
textField: ['id'],
132-
color: 'white',
133-
size: 12,
134-
offset: [0, 0.4],
135-
allowOverlap: true,
136-
ignorePlacement: true
137-
}
138-
}));
118+
// Add rendering layers above labels.
119+
map.layers.add([
120+
// Render an icon for each depot.
121+
new atlas.layer.SymbolLayer(depotDataSource, 'depot', {
122+
iconOptions: {
123+
image: 'depot-icon',
124+
size: 0.2,
125+
anchor: "center",
126+
allowOverlap: true,
127+
ignorePlacement: true
128+
}
129+
}),
130+
// Render a red icon for each stop.
131+
new atlas.layer.SymbolLayer(stopDataSource, 'stops', {
132+
iconOptions: {
133+
image: 'home-icon',
134+
size: 0.2,
135+
anchor: "center",
136+
allowOverlap: true,
137+
ignorePlacement: true
138+
}
139+
})
140+
]);
139141
});
140142
});
141143
}
@@ -152,14 +154,14 @@
152154
// We need all coordinates together depots + stops
153155
const allCoordinates = [...depots, ...stops];
154156

155-
// Get the matrix for all coordinates
157+
// Get the Azure Maps Matrix results for all coordinates
156158
const matrix = await getMatrixAsync(allCoordinates);
157159

158-
// We use the NVIDIA cuOpt optimizer service to calculate the Multi-Itinerary Optimization.
160+
// We use the NVIDIA cuOpt optimizer service to calculate the Multi-Itinerary Optimization
159161
// more details: https://docs.nvidia.com/cuopt/user-guide/supported-features.html
160162
const solver = await getOptimizedRouteAsync(matrix);
161163

162-
// Render the route on the map for each vehicle
164+
// Render the route on the map for each vehicle using Azure Maps Route API
163165
renderRoutes(allCoordinates, solver);
164166

165167
// Hide loading icon

‎Static/images/icons/depot.png‎

3.29 KB
Loading

‎Static/images/icons/factory.png‎

2.79 KB
Loading

‎Static/images/icons/home.png‎

1.97 KB
Loading

0 commit comments

Comments
 (0)