Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
显示 KML 数据
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
数据集的数据驱动型样式
您可以将 KML 数据作为数据集上传,并使用数据驱动型样式在地图上显示这些数据。这种方法可提供更好的性能和更多样式选项。
如需开始使用数据集,请参阅数据集概览。
第三方库
您还可以使用第三方库在浏览器中解析 KML 文件,并
使用 Maps JavaScript API 的
数据层或其他叠加层显示数据。
用于解析 KML 的热门第三方库包括:
将 KML 数据转换为 GeoJSON 后,您可以使用 map.data.addGeoJson() 将其加载到数据层中。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-05-31。
[null,null,["最后更新时间 (UTC):2026-05-31。"],[],["This tutorial demonstrates how to display KML file information on a Google Map and in a sidebar. Key actions include: initializing a Google Map, creating a `KmlLayer` object to load a KML file from a URL, and configuring the layer to suppress info windows. An event listener is added to capture clicks on KML features. When a click occurs, the feature's `infoWindowHtml` content is extracted and used to update the content of a designated sidebar `div`, dynamically displaying the selected feature's information.\n"]]