Instance Method


Converts imported GeoJSON data to MapKit JS items.


ItemCollection|Error importGeoJSON(String|Object data, optional function|GeoJSONDelegate callback);



The original GeoJSON data, which may be a URL to a GeoJSON file, or a GeoJSON object.


A callback function that is required if you provide a URL for the data parameter, and optional otherwise.

Return Value

If the data argument is a GeoJSON object instead of a URL and you provide no callback function, importGeoJSON returns an ItemCollection. If the data import fails, an error is returned.


This function converts imported GeoJSON data to MapKit JS items, which are annotations, overlays, and/or ItemCollection objects. Access the original GeoJSON data through the object's data property.

You can customize the import by implementing a GeoJSONDelegate callback:

  • If you provide a GeoJSON object for the data parameter, importGeoJSON returns the result directly. However, if you provide an optional callback, it is used.

  • If you provide a URL to a GeoJSON file in the data parameter, you must provide a callback function.

The callback is invoked with two arguments, error on failure and result on success, as follows:

error (Error)

Contains an error code and descriptive message.

result (Item)

The resulting ItemCollection. The raw GeoJSON used to generate the object is tored in the object's data property.

See Also

Geographical Features

Displaying Indoor Maps with MapKit JS

Use the Indoor Mapping Data Format (IMDF) to show an indoor map with custom overlays and points of interest in your browser.


A delegate object that controls a GeoJSON import in order to override default behavior and provide custom style.


A tree structure containing annotations, overlays, and nested item collection objects.