How to get a link to a Google api Staticmap map fragment in PNG format

Please tell me. Through the Google staticmap api, you can get a link to a map fragment, that is, to an image, but the problem is that this link does not specifically mention that it is a picture, for example, png, jpeg.

Is it possible to somehow get another link to the same map fragment only with a specific name that this file has a picture? https://maps.googleapis.com/maps/api/staticmap?sensor=false&size=640x640&visual_refresh=true&scale=2&center=30,0&zoom=2&maptype=roadmap

The option to specify the .png format at the end of the link does not work. This should be specified before all auxiliary characters that denote coordinates, etc. I know that Google has a property like format png, this also does not work.

For example, the staticmap Mapbox api, there is a mention that this is a picture, this is in the specified in before the first question mark, and the program downloads the image. https://api.mapbox.com/v4/mapbox.emerald/-73.7638,42.6564,8/[email protected]?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY5YzJzczA2ejIzM29hNGQ3emFsMXgifQ.az9JUrQP7klCgD3W-ueILQ

The same question for Yandex maps, they are also without png and also do not download https://static-maps.yandex.ru/1.x/?ll=37.620070,55.753630&size=600.450&z=13&l=map & amp

Please help me, I've been struggling with this for a week now I can't find the answer anywhere.

Author: Сергей, 2018-04-21

1 answers

The mention that this image is in the HTTP header Content-Type.

In this case, it is image/png.

Note that with caching enabled, Yandex may give you the 304 Not Modified and Content-Type: text/plain header. In this case, you need to determine the content type yourself from the cached image or add a random parameter to the query string.

 0
Author: KazeZlat, 2018-08-16 05:57:27