---
title: "kmlToGeoJSON | Mobile sdk | Mobile sdk android | Android"
description: "kmlToGeoJSON"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# kmlToGeoJSON

suspend fun [kmlToGeoJSON](https://docs.maptiler.com/mobile-sdk/android/api/-map-tiler-s-d-k/com.maptiler.maptilersdk.map/-m-t-map-view-controller/kml-to-geo-j-s-o-n/)(kmlXml: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)?

Converts a KML XML payload to a GeoJSON FeatureCollection string using the SDK converter.

This does not mutate the map and can be used to prepare data for a `GeoJSON` source.

#### Return

The GeoJSON FeatureCollection as a compact JSON string, or null on failure.

#### Parameters

kmlXml

The KML file contents as a string.
