<!--
{
  "availability" : [
    "MapKit JS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/GeoJSONDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Interface",
  "symbol" : {
    "kind" : "Interface",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "struct/mapkit.GeoJSONDelegate"
  },
  "title" : "GeoJSONDelegate"
}
-->

# GeoJSONDelegate

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

```
interface GeoJSONDelegate
```

## Overview

The delegate object provides hooks into the key moments in the GeoJSON import process. When you pass a delegate object to the [`importGeoJSON(data, callback)`](/documentation/MapKitJS/mapkit/importGeoJSON) method, you can:

- Modify or replace annotations and overlays before MapKit JS adds them to the [`ItemCollection`](/documentation/MapKitJS/ItemCollection) object.
- Override the default GeoJSON mapping behavior.
- Provide custom styling by implementing [`styleForOverlay(overlay, geoJSON)`](/documentation/MapKitJS/GeoJSONDelegate/styleForOverlay).
- Receive feedback on the result from importing GeoJSON data.

## Topics

### Overriding items

[`itemForFeature?(
    item: Item | null,
    geoJSON: GeoJSONTypes.Feature,
): Item | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForFeature)

Overrides a feature.

[`itemForFeatureCollection?<D extends GeoJSONTypes.FeatureCollection>(
    itemCollection: ItemCollection<D>,
    geoJSON: D,
): ItemCollection<D> | Item[] | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForFeatureCollection)

Overrides a feature collection.

[`itemForLineString?(
    overlay: PolylineOverlay,
    geoJSON: GeoJSONTypes.LineString,
): PolylineOverlay | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForLineString)

Overrides a line string.

[`itemForMultiLineString?<D extends GeoJSONTypes.MultiLineString>(
    itemCollection: ItemCollection<D>,
    geoJSON: D,
): ItemCollection<D> | Item[] | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForMultiLineString)

Overrides a multiline string.

[`itemForPoint?(
    coordinate: Coordinate,
    geoJSON: GeoJSONTypes.Point,
): Item | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForPoint)

Overrides a point.

[`itemForMultiPoint?<D extends GeoJSONTypes.MultiPoint>(
    itemCollection: ItemCollection<D>,
    geoJSON: D,
): ItemCollection<D> | Item[] | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForMultiPoint)

Overrides a multipoint object.

[`itemForPolygon?(
    overlay: PolygonOverlay,
    geoJSON: GeoJSONTypes.Polygon,
): PolygonOverlay | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForPolygon)

Overrides a polygon.

[`itemForMultiPolygon?<D extends GeoJSONTypes.MultiPolygon>(
    itemCollection: ItemCollection<D>,
    geoJSON: D,
): ItemCollection<D> | Item[] | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForMultiPolygon)

Overrides a multipolygon.

[`styleForOverlay?(
    overlay: PolylineOverlay | PolygonOverlay,
    geoJSON: GeoJSONTypes.LineString | GeoJSONTypes.Polygon,
): Style;`](/documentation/MapKitJS/GeoJSONDelegate/styleForOverlay)

Overrides the style of overlays.

### Handling errors and completion

[`geoJSONDidComplete?<D extends GeoJSONTypes.GeoJSON>(
    result: ItemCollection<D>,
    geoJSON: D,
): void;`](/documentation/MapKitJS/GeoJSONDelegate/geoJSONDidComplete)

Completes the GeoJSON import.

[`geoJSONDidError?(
    error: GeoJSONImportError | Error,
    geoJSON?: GeoJSONTypes.GeoJSON,
): void;`](/documentation/MapKitJS/GeoJSONDelegate/geoJSONDidError)

Indicates when the GeoJSON import fails.

### Instance Methods

[`itemForGeometryCollection?<D extends GeoJSONTypes.GeometryCollection>(
    item: ItemCollection<D>,
    object: D,
): ItemCollection<D> | Item[] | null;`](/documentation/MapKitJS/GeoJSONDelegate/itemForGeometryCollection)

Overrides a geometry collection with the provided item and object.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)