Google API-Web地图中未显示KMZ文件
我正在尝试获取KMZ文件以将其加载到Google Map API的顶部,但是KMZ文件没有出现.下面是我的代码,当我加载HTML时一切正常执行-KMZ文件丢失了.我试图通过仅将一个要素图层而不是整个地图文档转换为KMZ来最小化文件的大小,但是我遇到了同样的问题.
I am attempting to get a KMZ file to load ontop of a Google Map API and the KMZ file is not appearing. Below is my code and everything executes properly when I load the HTML--the KMZ file is just missing. I tried to minimize the size of the file by converting only one feature layer vs the entire map document to KMZ but I had the same problem.
想法?
<!DOCTYPE html>
<html>
<head>
<title>Map Title, USA</title>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAx70- gnDWt1nCCf_pLezTNqZfH2G_im04"></script>
<script>
function initialize()
{
var mapProp = {
center:new google.maps.LatLng(38.89,-77),
zoom:12,
mapTypeId:google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);
var kmlPath = https://sites.google.com/site/geos455assignment/data_files/assignment-4/Turi_Kristen_GEOS455_Assign4.kmz';
var urlSuffix = (new Date).getTime().toString();
var layer = new google.maps.KmlLayer(kmlPath + '?' + urlSuffix );
layer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>`
</head>
<body>
<div id="googleMap" style="width:1384px;height:936px;"></div>
</body>
</html>
返回KmlStatus"DOCUMENT_TOO_LARGE":
returns a KmlStatus of "DOCUMENT_TOO_LARGE":
Kml状态:DOCUMENT_TOO_LARGE
Kml Status:DOCUMENT_TOO_LARGE
- 原始链接(不再有效)
- 限制:
- original link (no longer valid)
- Limits:
- 最大提取文件大小(原始KML,原始GeoRSS或压缩的KMZ)3MB
- 未压缩的最大KML文件大小为10MB
- 最大网络链接数10
- 文档范围内的功能总数最大为1,000
- 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
Google地图中KML渲染的大小和复杂度限制
Google Maps当前对已加载的KML文件的大小和复杂性有特定的限制.以下是当前限制的摘要:
Google Maps currently has specific limitations to the size and complexity of loaded KML files. Below is a summary of the current limits:
注意:这些限制是暂时的,随时可能更改.
您的KML为18.3 MB,需要小于10MB.
Your KML is 18.3 MB, it needs to be less than 10MB.
您的选择是:
- 将您的KMZ文件分为2个单独的文件,其中KML为< 10 MB
- 使用第三方KMZ解析器(例如 geoxml3 ),但这可能会导致性能问题. 使用geoxml3的示例(kmz分支)和您的KMZ托管在我的服务器上)
- break your KMZ file into 2 separate files containing KML of < 10 MB
- use a third party KMZ parser (like geoxml3), but that may have performance issues. Example using geoxml3 (kmz branch) and your KMZ hosted on my server)