Import GeoJSON


You can mimic the import functionality you see in Operator by making your own import process for GeoJSON files.

We'll assume you know how to upload files through the API and that you have access to a TempFile.ID or ClientFile.ID.

Import

GeoJSON Import

Request body
interface IPostBody {
    // Previously uploaded temp file ID or Client File ID.
    // One of these is required.
    "TempFile.ID": string;
    // File name used for creating an import record.
    // Eg: 'my-file.geojson'.
    // If you specify a Client File ID, this is not needed as the name is already known.
    "TempFile.Name": string;
    "ClientFile.ID": string;

    // Specifies how the features should be imported.
    // Eg: 'A' for add, 'U' for update, 'R' for replace (delete before importing).
    // You can also use 'U+A' to update or add (our default).
    // Or 'U+A+D' to update or add, then delete any Entities not in the GeoJSON.
    // These are all relative to the specified Entity Type.
    "ImportMode": "A" | "U" | "R" | "U+D" | "U+A" | "U+D+A";
    // Set to true to skip features that fail to import.
    // If false, the first failure will stop the import.
    "SkipFailedFeatures"?: boolean;

    // Destination Entity Type.
    "EntityType.ID": string;
    // Array of Nextspace Tag IDs to apply to all imported Entities.
    "AddLayerIDs"?: number[];

    // Data mapping for the GeoJSON properties to the target Entity Type schema.
    "DataMapping": any;
}
Response
interface IResponse {
    "PendingActionID": number;
}
Javascript example

When the Pending Action is marked as completed, here is the result to expect:

interface IResult {
    // Number of failed to import features.
    "CountFailed": number;
    // Number of successfully imported features.
    "CountImported": number;
}