On Nov 30, 6:44 pm, bratliff <[EMAIL PROTECTED]> wrote:
> > > What about situations where we ask for a span from the Static API
> > > (because we want to ensure that a certain area is visible)? Then I
> > > think we won’t know the zoom level z...
>
> > Why don't you calculate the zoom level (which fits your data) by
> > yourself?
>
> I agree. You cannot depend on Google's span to be identical to
> yours. It may apply an unknown amount of padding.
>
> You may be able to use the following:
>
> ~~(21-(Math.log(Math.max(x/X,y/Y))/Math.LN2))
>
> where:
>
> X = static map width
> Y = static map height
> x = Math.abs(LToX(Lon0)-LToX(Lon1));
> y = Math.abs(LToY(Lat0)-LToY(Lat1));
>
> "~~" performs integer truncation.
>
> The relevant section regarding server modification of Google's images
> is 10.2.
>
> http://code.google.com/apis/maps/terms.html
You might prefer the following:
~~ (21 - (Math.log(Math.max(x / X , y / Y)) * Math.LOG2E))
Generally floating point multiplication is faster & more accurate than
floating point division.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---