Bing Static Map Image type

二次信任 提交于 2019-12-12 06:13:27

问题


May I know how to determine the output of Bing map static image? Previously it used to be in png but now it is in jpeg. May I know how to revert back to png format?

Example: Display the image with the link below:

http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/space%20needle,seattle?mapLayer=TrafficFlow&mapVersion=v1&key=BingKey

The image is in jpeg. How to make it to png? Thanks.


回答1:


I don't think you can request the image in a different format.

From http://msdn.microsoft.com/en-us/library/ff701724.aspx :

This URL returns an image in one of the following formats:

  • PNG (image/png)
  • JPEG (image/jpeg)
  • GIF (image/gif)

You cannot specify the output format for the map image. The image type is chosen based on parameters such as imagerySet.

If you really want a PNG, you could make the request from a server-side script and then construct a PNG file programmatically before serving that back to the client (using PHP's imagepng function, for example)




回答2:


I know it's a while you posted this question, but as there is no answer yet, and I got here via Google I'll supply an answer anyway.

You can use the format / fmt parameter.

From: http://msdn.microsoft.com/en-us/library/ff701724.aspx

One of the following image format values:

  1. gif: Use GIF image format.

  2. jpeg: Use JPEG image format. JPEG format is the default for Road, Aerial and AerialWithLabels imagery.

  3. png: Use PNG image format. PNG is the default format for CollinsBart and OrdnanceSurvey imagery.

Examples:

format=jpeg

fmt=gif



来源:https://stackoverflow.com/questions/6205006/bing-static-map-image-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!