Hello Balasaheb Molawade,
The Bing Maps REST Services do not support fetching multiple boundaries in a single request directly. However, you can loop through multiple locations and make individual requests for each boundary using C#. Here's a sample implementation:
Ref doc: https://learn.microsoft.com/en-us/bingmaps/rest-services/using-the-rest-services-with-net
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static readonly string bingMapsKey = "YOUR_BING_MAPS_KEY";
static readonly string baseUrl = "https://platform.bing.com/geo/spatial/v1/public/Geodata";
static async Task Main(string[] args)
{
string[] zipCodes = { "98004", "98005", "98007", "98008", "98039" };
foreach (var zip in zipCodes)
{
string url = $"{baseUrl}?SpatialFilter=GetBoundary('{zip}',1,'Postcode1',1,0)&$format=json&key={bingMapsKey}";
var boundary = await GetBoundaryAsync(url);
Console.WriteLine($"Boundary for {zip}:\n{boundary}\n");
}
}
static async Task GetBoundaryAsync(string url)
{
using HttpClient client = new HttpClient();
return await client.GetStringAsync(url);
}
}
Hope this helps!
Thank you!