Google地图:多次访问后,某些KMZ图层消失了 [英] Google Maps: Some KMZ layers disappear after many access

查看:130
本文介绍了Google地图:多次访问后,某些KMZ图层消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我正在开发一个地图,其中包含压缩为KMZ文件(约45mb)的KML图层. 由于文件重量的限制,我首先将文件分成3mb个文件. 然后我注意到有些拆分文件没有每次都显示,从而导致地图上出现一些空白". 因此,我在许多论坛上进行了研究,发现为了使一切正常工作,文件的实际限制是2mb. 更新后,"KML层"确实显示完整.

Recently I'm developping a Map containing KML Layer compressed as KMZ file (about 45mb). As there is a file weight limitation, I first split the files into 3mb files. Then I noticed that some splitted files was not showing everytime, causing some "blanks" on the map. So I made researches on many forums, and found that the real limitation of files in order to get everything working properly is 2mb. After update, the KML Layer was indeed showing entierely.

但是,经过多次测试,我发现某些零件又消失了. 目前,大约有一半未显示的部分,例如被Google Maps API拒绝的部分(被拒绝的部分始终相同,并且没有增加,因此我认为它们是无效的). 我再次对Google Maps KML Layer API和限制/验证进行了很多研究,但找不到与我的问题匹配的任何信息.

However, after doing many tests, I seen that some parts was disappearing again. Currently there about half of parts that are not showing, like they were rejected by Google Maps API (the rejected parts are always the same, and they are not increasing so I think they are not valid). I did again many research on Google Maps KML Layer API and limitations/validation but couldnt find any information that match with my problem.

Google Maps API不会发送错误,只是得到空响应,如:

Google Maps API does not send error, just got null response like:

/**/_xdc_._swjxb2 && _xdc_._swjxb2( [0,null,null,null,null,null,4,[["client","2"]]] )

有人知道关于文件限制/验证的规则吗? 一个KMZ URL是否有访问限制?还是因为文件无效?如果是这样,如何检查我的文件是否有效?

Does anyone knows the rules about files limitation/validation ? Is there a limit of access for one KMZ URL ? Or it is because the file is invalid ? If so, how to check if my file is valid ?

这是从其中一个被拒绝的KML文件中提取的KML:

Here is the KML extracted from one of the KML files that are rejected:

下载URL: https://mega.nz/#!zohkmSAQ

密钥:!4HfbSLDpazhXHsTpFLOgfgXirRbt2usNFVy-ZYoDNcw

KEY: !4HfbSLDpazhXHsTpFLOgfgXirRbt2usNFVy-ZYoDNcw

由于某些原因,我只删除了内部的代码. 但是这是它的格式:

For some reasons, I only removed code that was inside . But here is its format:


<![CDATA[<html xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<head>
<META http-equiv="Content-Type" content="text/html">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<table>
<td>NAME</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
<tr>
<td>LABEL</td>
<td></td>
</tr>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
<tr>
<td>LABEL</td>
<td>VALUE</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>]]>

我试图将扩展名重命名为xml,然后用Chrome打开它,以检查其格式是否正确,但是Chrome已正确对其进行了解析.

I tried to rename extension as xml and open it with Chrome to check if it is well formated, but it was properly parsed by Chrome.

通过升级服务器以上传KMZ文件解决了问题.

Problem was solved by upgrading server for KMZ file upload.

推荐答案

KML文档中的限制

KML渲染的大小和复杂性限制
Maps JavaScript API对加载的KML文件的大小和复杂性有限制.以下是当前限制的摘要.

Size and complexity restrictions for KML rendering
The Maps JavaScript API has limitations to the size and complexity of loaded KML files. Below is a summary of the current limits.

注意:这些限制随时可能更改.

Note: These limits are subject to change at any time.


Maximum fetched file size (raw KML, raw GeoRSS, or compressed KMZ)          3MB
Maximum uncompressed KML file size 10MB
Maximum number of network Links 10
Maximum number of total document-wide features 1,000

KML层数
可以在单个Google Map上显示的KML层数是有限制的.如果超出此限制,则所有图层都不会出现在地图上,并且将在Web浏览器的JavaScript控制台中报告错误.该限制基于创建的KmlLayer类的数量和用于创建这些层的所有URL的总长度的组合.您创建的每个新的KmlLayer都会占用该层的一部分限制,而另一部分则取决于从中加载KML文件的URL的长度.因此,您可以添加的层数将因应用程序而异.平均而言,您应该能够加载10到20层之间的数据,而不会达到限制.如果仍然达到限制,请使用URL缩短器来缩短KML URL.另外,也可以创建一个单个KML文件,该文件由指向各个KML URL的NetworkLink组成.

Number of KML layers
There is a limit on the number of KML Layers that can be displayed on a single Google Map. If you exceed this limit, none of your layers will appear on the map, and an error will be reported in your web browser's JavaScript console. The limit is based on a combination of the number of KmlLayer classes created and the total length of all the URLs used to create those layers. Each new KmlLayer you create will take up a portion of the limit for the layer and a further portion of the limit depending on the length of the URL where the KML file was loaded from. Consequently, the number of layers you can add will vary by application; on average, you should be able to load between 10 and 20 layers without hitting the limit. If you still hit the limit, use a URL shortener to shorten the KML URLs. Alternatively, create a single KML file consisting of NetworkLinks to the individual KML URLs.

您发布的KML为5MB(超出了可提取的最大文件大小).

The KML you posted is 5MB (which exceeds the maximum fetched file size).

给出FETCH_ERROR

但是可以加载第三方库geoxml3 (但是将其转换为浏览器中的常规"谷歌地图对象,性能可能会受到影响)

But can be loaded with the third party library geoxml3 (but as that translates it into "normal" google maps objects in the browser, performance may suffer)

已压缩(KMZ)仍然给我一个FETCH_ERROR

仍然使用geoxml3加载

这篇关于Google地图:多次访问后,某些KMZ图层消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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