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

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

# gpxToGeoJSON

suspend fun [gpxToGeoJSON](https://docs-qmgv.pages.dev/mobile-sdk/android/api/-map-tiler-s-d-k/com.maptiler.maptilersdk.map/-m-t-map-view-controller/gpx-to-geo-j-s-o-n/)(gpxXml: [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 GPX 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

gpxXml

The GPX file contents as a string.
