bing map api will get 404 when the request url is too long

Jimmy 5 Reputation points
2023-05-27T10:38:14.9033333+00:00

The test code looks like:

const url = 'http://dev.virtualearth.net/REST/v1/Elevation/List'
      const res = await axios.get(url, {
        params: {
          key: this.configService.get('bingMapApiKey'),
          points: cors,
        },
      })

from the docs the points max pairs are 1024, but it does not work. in my testing, if the points are > 100, the request will throw a 404 error. how to resolve the error?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
606 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 13,180 Reputation points
    2023-05-27T11:59:07.92+00:00

    The Bing Maps Elevation API indeed allows up to 1024 points in a single request, as documented. However, there's a limit to the length of a URL that servers and clients will accept, which could be causing your problem if the total number of characters in the URL exceeds this limit. HTTP URLs are typically limited to around 2000-2048 characters in length depending on the client and server configuration.

    1 person found this answer helpful.