На этой странице показано, как визуализировать географические данные в формате KML, используя GMUKMLParser в сочетании с GMUGeometryRenderer . KML — популярный формат для отображения географических данных, таких как точки, линии и многоугольники.
На следующем снимке экрана показан пример данных KML, отображаемых на карте:
Полный пример кода см. в примерах приложений на GitHub .
Отображение данных KML
Чтобы отобразить данные KML на карте, создайте GMUKMLParser с путем к ресурсу KML (в этом примере KML_Sample.kml ). Затем создайте GMUGeometryRenderer , передав экземпляр GMUKMLParser . Наконец, вызовите GMUGeometryRenderer.render() . В следующем примере кода показано отображение данных KML на карте:
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-07-23 UTC."],[[["\u003cp\u003eThis documentation explains how to render geographic data in KML format using the \u003ccode\u003eGMUKMLParser\u003c/code\u003e and \u003ccode\u003eGMUGeometryRenderer\u003c/code\u003e within the Google Maps SDK for iOS Utility Library.\u003c/p\u003e\n"],["\u003cp\u003eKML is a popular format used for displaying geographic data, including points, lines, and polygons, on maps.\u003c/p\u003e\n"],["\u003cp\u003eTo render KML data, create a \u003ccode\u003eGMUKMLParser\u003c/code\u003e instance with the path to your KML file, then use it to initialize a \u003ccode\u003eGMUGeometryRenderer\u003c/code\u003e, and finally, call \u003ccode\u003erender()\u003c/code\u003e on the renderer to display the data on your map.\u003c/p\u003e\n"],["\u003cp\u003eCode examples in both Swift and Objective-C are provided to demonstrate the process of rendering KML data on a map using the Google Maps SDK for iOS.\u003c/p\u003e\n"]]],[],null,[]]