private static void MapSpatialUnits(Sitplugin sitplugin, JToken mappingConfig)
        {
            if (!Enum.TryParse((string)mappingConfig["mapping_mode"], out SpatialUnitClassifierMode mode))
            {
                throw new ArgumentException("expected one of the SpatialUnitClassifierMode enum values");
            }
            switch (mode)
            {
            case SpatialUnitClassifierMode.JoinedAdminEcoClassifier:
                sitplugin.SetSPUMapping((string)mappingConfig["spu_classifier"]);
                foreach (var item in mappingConfig["spu_mapping"])
                {
                    sitplugin.MapSpatialUnit(
                        (string)item["user_spatial_unit"],
                        (string)item["default_spatial_unit"]["admin_boundary"],
                        (string)item["default_spatial_unit"]["eco_boundary"]);
                }
                break;

            case SpatialUnitClassifierMode.SeperateAdminEcoClassifiers:
                sitplugin.SetAdminEcoMapping(
                    (string)mappingConfig["admin_classifier"],
                    (string)mappingConfig["eco_classifier"]);
                if (mappingConfig["admin_mapping"] != null)
                {
                    foreach (var item in mappingConfig["admin_mapping"])
                    {
                        sitplugin.MapAdminBoundary(
                            (string)item["user_admin_boundary"],
                            (string)item["default_admin_boundary"]);
                    }
                }
                if (mappingConfig["eco_mapping"] != null)
                {
                    foreach (var item in mappingConfig["eco_mapping"])
                    {
                        sitplugin.MapEcoBoundary(
                            (string)item["user_eco_boundary"],
                            (string)item["default_eco_boundary"]);
                    }
                }
                break;

            case SpatialUnitClassifierMode.SingleDefaultSpatialUnit:
                sitplugin.SetSingleSpatialUnit((int)mappingConfig["default_spuid"]);
                break;
            }
        }