KML中的自定义图标有时会在Google Maps中中断 [英] Custom icons in KML occasionally break in Google Maps

查看:121
本文介绍了KML中的自定义图标有时会在Google Maps中中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,这可能有点棘手,因为问题只是偶尔且不可预测地出现-希望问题在您查看此问题时出现(或者,已不再出现!).

So this might be a bit tricky to demonstrate, since the problem only appears occasionally and unpredictably--hopefully the problem shows up when you view this question (or, alternatively, has stopped appearing altogether!).

我们的网站上有一个Google Maps实现,可在地图上显示分页的搜索结果.当前页面的结果显示为常规Google Maps标记(带有自定义图标-这些效果很好),而其他搜索结果在KML图层中显示为较小的标记.一个例子:

We have a Google Maps implementation on our site that displays paginated search results on a map. The current page's results appear as regular Google Maps markers (with custom icons--these work fine), but the other search results appear as smaller markers in a KML layer. An example:

http://www.redflagdeals.com/in/verdun/map/

大标记是方形的图钉图像;小标记是彩色的点.蓝色和紫色标记/点仅表示不同类型的内容.在KML文件中,我们指定了两种样式,每种内容类型一种.除了指向不同图钉图像的图标"参考之外,这两个元素完全相同.这是一个示例生成的KML文件供参考:

The large markers are squarish pin images; the small markers are coloured dots. Blue and purple markers/dots simply refer to different types of content. In the KML file, we've specified two Styles, one for each content type. Other than the Icon reference, which points to the different pin images, the two elements are exactly the same. Here's an example generated KML file for reference:

http://www.redflagdeals.com/in/verdun/map/?do=map_kml& ; longitude = -73.56895400000002& latitude = 45.457064& order = deal_price& dir = asc& category_filter = 0& content_filter = 0& tag_filter = 0& keyword =& page = 1& show = deal%20coupon

大多数时候,我们的地图都能完美地显示大小标记.不过,偶尔会出现一些或所有小图钉而没有自定义图标,而是恢复为通用的蓝色Google标记图片.如今,以蓝色显示的自定义微型别针已损坏,而紫色的微型别针都没问题.其他时候,蓝色和紫色都坏了.

Most of the time, our map shows the large and small markers perfectly. Occasionally, though, some or all of the small pins show up without the custom icons, instead reverting to the generic blue Google marker image. Today, the custom minipins that show up in blue are broken, while the purple ones are all fine. Other times, both the blue and purple ones are broken.

问题通常会自行解决,因此对原因或解决方案一无所知.我唯一的理论是,我们使用CDN来承载标记图像,有时我们会在同时更新所有文件名的同时将新版本推送到CDN(因为我们图像的URL中有CDN版本号).也许当我们推出新的CDN版本,获取404并立即放弃时,Google可能会要求正确显示一个或两个小图钉图像.但这意味着Google会在相当长的时间内缓存KML图像(或缺少KML图像).除此之外,我没有任何想法.

The problem usually fixes itself, leaving us clueless as to the cause or the solution. The only theory I have is that we use a CDN to host our marker images, and occasionally we push a new version to the CDN while updating all the filenames simultaneously (as we have CDN version numbers in the URLs for our images). Maybe it's possible Google is requesting one or both of the small pin images right when we're pushing a new CDN version, getting a 404, and giving up immediately. But that would mean Google caches the KML images (or lack thereof) for quite a long time. Other than that, I have no ideas.

我们有什么办法可以防止将来出现此问题?

Is there anything we can do to prevent this problem from cropping up in the future?

推荐答案

请参阅此帖子(特别是注释4)介绍了自定义标记的缓存 http://code.google.com/p/gmaps -api-issues/issues/detail?id = 3864

see this post (Comment #4 specifically) explains caching of custom markers http://code.google.com/p/gmaps-api-issues/issues/detail?id=3864

这篇关于KML中的自定义图标有时会在Google Maps中中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆