(English translation is at the end)

自从我 “发现”Leaflet Maps Marker 并把它作为自己最喜欢的 WordPress 地图插件,以及与原作者 Robert Harm 联系并光荣的参与了插件汉化工作一直到现在以来,这款插件就以其专业的设计、经常的更新、功能的完善牢牢占据了我的心。使用至今,曾出现过的一些小问题都已被勤奋的作者 Robert 一一订正。但是有一个问题一直无法解决:在中国,我们伟大的墙把谷歌的很多服务 ban 掉了,Maps Marker 提供的一些服务也未能幸免,哪怕不使用 Google Maps,其在加载地图时依旧出现等待时间巨长(一般超过 40 秒)的情况。症状:

Leaflet Maps Marker
Leaflet Maps Marker

经仔细研究,是因为在加载 QR 代码 “在全屏模式创建 QR 代码图片” 时使用了 chart.useso.com 的缘故。

<a href=https://chart.useso.com/chart?chs=150x150&amp;cht=qr&amp;chl=/wp-content/plugins/leaflet-maps-marker/leaflet-fullscreen.php?layer=1 target="_blank" title="在全屏模式创建 QR 代码图片"><img src=/wp-content/plugins/leaflet-maps-marker/inc/img/icon-qr-code.png width="14" height="14" alt="QR-code-logo" class="lmm-panel-api-images" /></a>

因此只需将之禁掉便可。方法:插件 “地图默认值”→“新层地图的默认值”→“QR 代码” 前的√号去除即可。

Leaflet Maps Marker
Leaflet Maps Marker
Leaflet Maps Marker
Leaflet Maps Marker

如果用不到的话,所有 API 链接都可以去除,不过个人建议可以保存 XML、全屏两个代码,方便别人下载你的地标。

另外,建议中国大陆用户把默认地图设为 “Mapquest (OSM)” 或 “必应地图”(必应地图要 API key),并且不要将谷歌地图设为可选地图(设置→地图默认值→控制台提供的基础地图→将所有谷歌地图反选)。

经测试,速度有数倍的提高,至少快了 20 多秒!


A Tip To Solve Slow Loading Of Leaflet Maps Marker For Mainland China Users

Since I ever “discovered” Leaflet Maps Marker and set it as my personal favorite WordPress plugin, then contacted with Robert Harm and took part in the translation job, the plugin stays in my heart for its professional design, frequent updates, and multiple functions. Till now, the appeared small problems had been solved by its diligent author Robert. But, there is one problem leaving unsolved: In our great Mainland China, our great firewall by Ministry of Industry and IT had banned or slowed down a lot of Google services including Google Maps because of disputes and distrusts with Google. So is Maps Marker’s map services. Even I don’t use Google Maps in Maps Marker, it takes super long loading time (generally more than 40 seconds) when maps are loaded. (See above screenshot 1)

After some research, I found the reason is because chart.useso.com was used when loading QR code “Create QR code image for standalone map in full-screen mode”. (See above HTML codes)

So all we have to do is just banning this code. Go to “Map defaults” ->”Default values for new layer maps”->uncheck “QR code”. (See above screenshot 2 & 3)

If APIs are not used, I suggest uncheck all API links, exclude XML and Full-screen mode for others to download your markers.

Moreover, I suggest all Mainland China users change the default map to “Mapquest (OSM)” or “Bing Map” (API key needed). I also suggest not to use Google Maps (Settings->Map defaults->Available basemaps in control box->uncheck all Google map services) if you wish to speed up map loading time.

My test shows that after these changes, map loading time is shortened a lot: At least 20 seconds faster!




经过前期一系列的测试,终于发现原来是 Google 的 http 协议导致了被墙,也就是说,Google 喜欢用的 https://是可以正常通过墙的,而 http://是不可以的。跟软件作者联系后,Robert 将本功能加入进去,彻底解决了此问题!

具体请见 Robert 在 Pro 版 v1.5.6 的更新日志中的阐述:

support for conditional SSL loading of Javascript for Google Maps

So far, the Google javascript need for Google Maps to displayed properly was loaded by default via https. John from China found out, that this was causing performance issues on his server, resulting in a notable lag when using Google Maps as basemap (thanks for the report!). I am not sure if this is an issue specific to China, as I also learned that with certain webserver configurations loading mixed ressources via https can result in poorer performance.

Anyway I changed this now with pro v1.5.6 and load Google Javascript only via https, if the site is also loaded via https.

共有 5 条评论

    1. @chojemmy 不专业啊,没有涉及编程,只是汉化以及软件设置而已。


      p.s. 去过你的博客,只能说,翻墙太累了,我表示评论无能。何不搞个提供国内外主机的国内服务商呢?

      Google Chrome 23 Google Chrome 23 Windows 7 Windows 7

Healson进行回复 取消回复

邮箱地址不会被公开。 必填项已用*标注