Skip to main content

Hello There

we are using Google static MAp Api in order to fetch static MAP for the line

since the api take the center point we thought we should use the bounding Box, get the center from there, but we are missing the zome level that should cover the entire line

https://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&key=YOUR_API_KEY

 

we are using image fetcher transformer

or do you have any other way to do it

 

0684Q00000ArAeqQAF.gif

Thanks

So the pixel resolution of a given tile should be 360/256^Zoom.

If you divide the size of the static image (400 in the example) by the size of the bounding box, you should get your expected resolution, then it's just a matter of determining the closest zoom level.

 

 

This assumes your bounding box is in decimal degrees, the equation becomes a little more complicated if you are working in a metered projection.


So the pixel resolution of a given tile should be 360/256^Zoom.

If you divide the size of the static image (400 in the example) by the size of the bounding box, you should get your expected resolution, then it's just a matter of determining the closest zoom level.

 

 

This assumes your bounding box is in decimal degrees, the equation becomes a little more complicated if you are working in a metered projection.

If I did the math correctly (and I'm uncaffeinated for 9 days, so no promises) this equation should be:

 

_zoom = @log(360*@Value(_size)/(@Value(_xmax)-@Value(_xmin)))/@log(2) - 8

 

 

where _size is the output image size (400 in the example)

 

 


If I did the math correctly (and I'm uncaffeinated for 9 days, so no promises) this equation should be:

 

_zoom = @log(360*@Value(_size)/(@Value(_xmax)-@Value(_xmin)))/@log(2) - 8

 

 

where _size is the output image size (400 in the example)

 

 

@jdh

Thanks great

Its works

 


Reply