开发者

Google maps api v3 shows a static image instead of an interactive map

Sometimes, when I load the map I get an static image (and without markers) instead the interactive map with their markers and controls.

I think this is a feature for slow connections:

http://code.google.com/intl/es-AR/apis/maps/articles/static+js.html

But then, there's an error in the API, because I'm stuck in that static image, the map is never loaded.

Do you know if is possible to disable the static image in APIv3 and force th开发者_如何学编程e interactive map to be loaded every time?


This is probably not the answer to your question, but I was having the same problem and found out that I was loading the API twice by mistake. Once I removed the duplicate script it all started working again.


NEWER/UPDATED ANSWER: Apparently, you used to be able to suppress this behavior by setting useStaticMap: false in your MapOptions object. However, there are reports that this stopped working around March. See this Google Groups thread. Perhaps it was restored and perhaps it wasn't. Searching for "useStaticMap" in the minified JavaScript code for Google Maps API v3 does yield a hit, so that's promising.

Note also the message in that thread that says that the name of the property was changed to useStaticMapImpl. A cursory search in the JavaScript doesn't locate that string, but if useStaticMap doesn't work, then that may be worth a shot too.

Again, good luck! If I could replicate this problem, I might be able to test some of these suggestions before shooting them off, but alas, I can't seem to make this happen, for whatever reason.

OLD ANSWER: I've been trying to get the behavior you describe to happen by slowing down my network connection using SpeedLimit on a Mac. I have been unable to do so. From that I conclude that perhaps if the problem is a slow connection, it might be a very slow connection. Therefore I suspect that disabling the feature may result in a map that simply doesn't load at all.

I can't find anything in the API Reference that would indicate an option for this feature. In fact, judging solely from the API Reference, this failover-to-static-maps thing doesn't exist. Although I do see where it is alluded to in the link you provide, so maybe the API Reference is incomplete.

All that said, if you wanted to try to disable the behavior, you might be able to do it by listening for a tilesloaded and/or idle event on the Map object. (The idle event supposedly fires when the map is loaded and ready to use, but the tilesloaded event seems like the more intuitive one. You may need to experiment to see which, if either, give you the result you want.) You could basically hide the <div> until the appropriate event fires.

Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜