MVFv3 API Documentation
    Preparing search index...
    • Creates a LocalePack partial MVF by comparing two full MVF objects in different languages.

      This function generates a LocalePack by identifying the differences between a base MVF and a localized MVF. It's particularly useful for extracting localized content changes from a fully localized MVF.

      Key features:

      1. Compares the base and localized MVF objects deeply.
      2. Includes only the properties and nested objects that differ in the locale pack.
      3. Handles arrays of objects with identifier keys, including only changed items.
      4. Preserves the structure of changed elements while omitting unchanged ones.
      5. Cleans up the manifest to include only relevant folder structure entries.

      Type Parameters

      • T extends {
            floors: {
                features: {
                    geometry:
                        | null
                        | { coordinates: [number, number][][]; type: "Polygon" }
                        | { coordinates: [number, number][][][]; type: "MultiPolygon" };
                    properties: {
                        elevation: number;
                        id: `f_${string}`;
                        maxHeight?: number;
                        subtitle?: string;
                    } & {
                        details?: {
                            description?: string;
                            externalId?: string;
                            icon?: string;
                            name?: string;
                            shortName?: string;
                        };
                    };
                    type: "Feature";
                }[];
                type: "FeatureCollection";
            };
            geometry: Partial<
                {
                    [x: `f_${string}`]: {
                        features: {
                            geometry: | { coordinates: [number, number]; type: "Point" }
                            | { coordinates: [number, number][]; type: "MultiPoint" }
                            | { coordinates: [number, number][]; type: "LineString" }
                            | { coordinates: [(...), (...)][][]; type: "MultiLineString" }
                            | { coordinates: [(...), (...)][][]; type: "Polygon" }
                            | { coordinates: (...)[][][]; type: "MultiPolygon" };
                            properties: { id: `g_${string}` } & {
                                details?: {
                                    description?: (...) | (...);
                                    externalId?: (...) | (...);
                                    icon?: (...) | (...);
                                    name?: (...) | (...);
                                    shortName?: (...) | (...);
                                };
                            };
                            type: "Feature";
                        }[];
                        type: "FeatureCollection";
                    };
                },
            >;
            manifest: {
                features: {
                    geometry: { coordinates: [number, number]; type: "Point" };
                    properties: {
                        contents: (
                            | {
                                children: (
                                    | (
                                        { type: "folder"; name: string; children: (any | { type: "file"; name: string; })[]; }
                                    )
                                    | { name: ...; type: ... }
                                )[];
                                name: string;
                                type: "folder";
                            }
                            | { name: string; type: "file" }
                        )[];
                        name: string;
                        time: string;
                        version: "3.0.0";
                        defaultFloor?: `f_${string}`;
                        language?: string;
                        mapId?: string;
                        naturalBearing?: number;
                        orgId?: string;
                        tzid?: `${string}/${string}`;
                    };
                    type: "Feature";
                }[];
                type: "FeatureCollection";
            };
        }

      Parameters

      • base: T

        The original ParsedMVF object to compare against.

      • locale: T

        The localized ParsedMVF object containing changes.

      Returns LocalePack<T>

      A ParsedMVFLocalePack containing only the differences between base and locale.

      Note: The resulting locale pack includes only the changed properties and maintains the structure necessary for these changes. The manifest is also cleaned up to include only relevant folder structure entries.

      Note: This WILL NOT produce correct results if the MVFs are different for reasons other than localization. For example, if the MVFs were generated at different times, and the "locale" MVF has objects that don't exist in the "base" MVF, the behaviour is undefined.