Hi Nilesh Khonde!
Welcome to the Microsoft Q&A and thank you for posting your questions here. To plot multiple SVG icons with dynamic numbers in Azure Maps, you can use the SymbolLayer. Here's a step-by-step guide to help you get started:
- Create a Data Source: First, create a data source and add it to the map.
- Create a Symbol Layer: Create a symbol layer and pass the data source to it.
- Add Data to the Data Source: Add your data points to the data source.
- Use SVG Icons: Use SVG icons for your symbols and customize them as needed.
Here's a sample code snippet to illustrate this:
function InitMap()
{
var map = new atlas.Map('myMap', {
center: [-73.985708, 40.75773],
zoom: 12,
view: "Auto",
//Add authentication details for connecting to Azure Maps.
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: '{Your-Azure-Maps-Subscription-key}'
}
});
map.events.add('ready', function () {
//Load the custom image icon into the map resources.
map.imageSprite.add('my-custom-icon', '/images/icons/showers.png').then(function () {
//Create a data source and add it to the map.
var datasource = new atlas.source.DataSource();
map.sources.add(datasource);
//Create a point feature and add it to the data source.
datasource.add(new atlas.data.Feature(new atlas.data.Point([-73.985708, 40.75773]), {
temperature: 64
}));
//Add a layer for rendering point data as symbols.
map.layers.add(new atlas.layer.SymbolLayer(datasource, null, {
iconOptions: {
//Pass in the id of the custom icon that was loaded into the map resources.
image: 'my-custom-icon',
//Optionally scale the size of the icon.
size: 0.5
},
textOptions: {
//Convert the temperature property of each feature into a string and concatenate "°F".
textField: ['concat', ['to-string', ['get', 'temperature']], '°F'],
//Offset the text so that it appears on top of the icon.
offset: [0, -2]
}
}));
});
});
}
You can also upload Geo Json file containing the co-ordinates and respective temperature, later to be replaced with icons.
Kindly refer these docs -
Add a Symbol layer to a map | Microsoft Learn
Thank you.