---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/dg/concepts/geoxml.md
  - https://yandex.com/dev/jsapi-v2-1/doc/ru/v2-1/dg/concepts/geoxml.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/jsapi-v2-1/doc/en/llms.txt

# Geo XML

The Yandex Maps API can load XML files with geographical data in [YMapsML](https://yandex.com/dev/maps/ymapsml/doc/1.x/guide/concepts/about.html), [KML](http://www.opengeospatial.org/standards/kml), and [GPX](http://www.topografix.com/gpx.asp) formats.

The [geoXml.load](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geoXml.load.md) function is used for loading data; it is passed the URL of the XML file. Data is loaded asynchronously (similar to [geocoding](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/dg/concepts/geocoding.md)), and the format of the loaded file is automatically detected by the `geoXml.load` file. Data about geo objects is converted to a [GeoObjectCollection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md) collection and inserted in the `geoObjects` field of the object to be passed to the handler function. This object can be placed on the map.

```javascript
ymaps.geoXml.load('/demo/openflights-sample.kml').then(function (res) {
    myMap.geoObjects.add(res.geoObjects);
});
```

XML data should be stored on a resource that has public access available. The file must be hosted on your server.

The YMapsML format allows for describing not only coordinates, geometric properties of geo objects and their visual display, but also for including a description of map parameters. Map parameters (if they are set) are in the `mapState` field as an object that allows to apply these parameters to any map.

```javascript
ymaps.geoXml.load('/export/usermaps/93jfWjoXws37exPmKH-OFIuj3IQduHal/').then(function (res) {
    myMap.geoObjects.add(res.geoObjects);
    if (res.mapState) {
        res.mapState.applyToMap(myMap);
    }
});
```

For collections that are formed from GPX tracks during loading, there are two [presets](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/dg/concepts/general.md#preset) defined, with the keys `gpx#interactive` and `gpx#plain`. The first one replaces the properties of polylines that are connected by GPX points, so that when any of these points is clicked on, additional information is shown (time, speed, and so on). This preset is used by default. For the second one, additional information is not produced.

```javascript
ymaps.geoXml.load('/MskChel2.xml').then(function (res) {
    res.geoObjects.options.set({'preset':'gpx#plain'});
    myMap.geoObjects.add(res.geoObjects);
});
```

