开发者

Google Maps Javascript API accidentally displaying view 'off the map'

I'm using the Google Maps Javascript API and I have LatLng coordinates that are dynamically generated. The problem is, sometimes I get coordinates and a zoom level that creates a map view that's 'off the chart' and this confuses users into thinking their map is not working. Is there a set of coordinates I should restrict values to in order to avoid this?

Example:

map = new google.maps.Map(document.getElementById("map"), {
    center: new google.maps.LatLng(-89.16090481395844开发者_开发问答, 59.24382269379974),
    zoom: 13,
    mapTypeId: 'roadmap',
    scaleControl: true,
    navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN }
});

Google Maps Javascript API accidentally displaying view 'off the map'

Users don't know what's happening unless they zoom out:

Google Maps Javascript API accidentally displaying view 'off the map'


Google Maps imagery stops at lat 85.0511 (-85.0511).

The value comes from features of spherical mercator projection that Google Maps is based on. You can find the formula used to calculate the value here: http://en.wikipedia.org/wiki/Mercator_projection#Uses

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜