Returns just the JSON that defines the current view.
@param  {Object} terria The Terria object.
@return {Object}
343562
function getShareData(terria) {
  const initSources = terria.initSources.slice();

  addUserAddedCatalog(terria, initSources);
  addSharedMembers(terria, initSources);
  addViewSettings(terria, initSources);
  addFeaturePicking(terria, initSources);
  addLocationMarker(terria, initSources);

  return {
    version: "0.0.05",
    initSources: initSources
  };
}
806836
function(terria) {
  CatalogItem.call(this, terria);

  this._dataUrl = undefined;
  this._dataUrlType = undefined;
  this._metadataUrl = undefined;
  this._geoJsonItem = undefined;

  /**
   * Gets or sets the WFS feature type names.
   * @type {String}
   */
  this.typeNames = "";

  /**
   * Gets or sets a value indicating whether we should request GeoJSON from the WFS server.  If this property
   * and {@link WebFeatureServiceCatalogItem#requestGeoJson} are both true, we'll request GeoJSON first and
   * only fall back on trying GML if the GeoJSON request fails.
   * @type {Boolean}
   * @default true
   */
  this.requestGeoJson = true;

  /**
   * Gets or sets a value indicating whether we should request GML from the WFS server.  If this property
   * and {@link WebFeatureServiceCatalogItem#requestGeoJson} are both true, we'll request GeoJSON first and
   * only fall back on trying GML if the GeoJSON request fails.
   * @type {Boolean}
   * @default true
   */
  this.requestGml = true;

  /**
   * Gets or sets the additional parameters to pass to the WFS server when requesting geometry.
   * All parameter names must be entered in lowercase in order to be consistent with references in TerrisJS code.
   * @type {Object}
   */
  this.parameters = {};

  knockout.track(this, [
    "_dataUrl",
    "_dataUrlType",
    "_metadataUrl",
    "typeNames",
    "requestGeoJson",
    "requestGml"
  ]);

  // dataUrl, metadataUrl, and legendUrl are derived from url if not explicitly specified.
  overrideProperty(this, "dataUrl", {
    get: function() {
      var url = this._dataUrl;
      if (!defined(url)) {
        url = this.url;
      }

      if (this.dataUrlType === "wfs") {
        url = new URI(cleanUrl(url))
          .setQuery(
            combine(
              {
                service: "WFS",
                version: "1.1.0",
                request: "GetFeature",
                typeName: this.typeNames,
                srsName: "EPSG:4326",
                maxFeatures: "1000"
              },
              this.parameters
            )
          )
          .toString();
      }

      return url;
    },
    set: function(value) {
      this._dataUrl = value;
    }
  });

  overrideProperty(this, "dataUrlType", {
    get: function() {
      if (defined(this._dataUrlType)) {
        return this._dataUrlType;
      } else {
        return "wfs";
      }
    },
    set: function(value) {
      this._dataUrlType = value;
    }
  });

  overrideProperty(this, "metadataUrl", {
    get: function() {
      if (defined(this._metadataUrl)) {
        return this._metadataUrl;
      }

      return new URI(cleanUrl(this.url))
        .setQuery(
          combine(
            {
              service: "WFS",
              version: "1.1.0",
              request: "GetCapabilities"
            },
            this.parameters
          )
        )
        .toString();
    },
    set: function(value) {
      this._metadataUrl = value;
    }
  });
}
175573
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        return api.to_iso_date(value) or default
312704
function WebProcessingServiceCatalogItem(terria) {
  CatalogItem.call(this, terria);

  this._geoJsonItem = undefined;

  /**
   * Gets or sets the parameters to the WPS function.
   * All parameter names must be entered in lowercase in order to be consistent with references in TerrisJS code.
   * @type {FunctionParameter[]}
   */
  this.parameters = undefined;

  /**
   * Gets or sets the values of the parameters that were used to invoke this function.
   * @type {Object}
   */
  this.parameterValues = undefined;

  /**
   * Gets or sets the URL of the WPS completed response.  This property is ignored if
   * {@link WebProcessingServiceCatalogItem#wpsResponse} is defined.  This property is observable.
   * @type {String}
   */
  this.wpsResponseUrl = undefined;

  /**
   * Gets or sets the completed WPS response, as either XML or the result of passing the
   * XML through {@link xml2json}.
   * @type {Object|Document}
   */
  this.wpsResponse = undefined;

  knockout.track(this, ["wpsResponseUrl", "wpsResponse"]);
}
486857
function(terria) {
  ImageryLayerCatalogItem.call(this, terria);

  this.url = defaultValue(this.url, "//api.mapbox.com/v4/");

  this.mapId = undefined;

  this.accessToken = undefined;

  /**
   * Gets or sets the file extension used to retrieve Open Street Map data
   * This property is observable.
   * @type {String}
   */
  this.fileExtension = "png";

  /**
   * Gets or sets the maximum tile level to retrieve from Open Street Map data
   * This property is observable.
   * @type {String}
   */
  this.maximumLevel = 25;

  knockout.track(this, ["fileExtension", "maximumLevel"]);
}
763925
function(json) {
      
      var r = function(o) {
          Object.keys(o).forEach(function(v, i) {

              if (o[v] !== null && typeof o[v] === 'object' && o[v].hasOwnProperty('$date')) {                
                  o[v] = moment(o[v]['$date']).toDate();
                  return;
              }
              if (o[v] !== null && typeof o[v] === 'object') return r(o[v])
          })
       }

       r(json);

       return json;
  }
957115
function(terria) {
  CatalogFunction.call(this, terria);

  this.url = undefined;
  this.name = "Regions like this";
  this.description =
    "Identifies regions that are _most like_ a given region according to a given set of characteristics.";

  this._regionTypeParameter = new RegionTypeParameter({
    terria: this.terria,
    catalogFunction: this,
    id: "regionType",
    name: "Region Type",
    description: "The type of region to analyze."
  });

  this._regionParameter = new RegionParameter({
    terria: this.terria,
    catalogFunction: this,
    id: "region",
    name: "Region",
    description:
      "The region to analyze.  The analysis will determine which regions are most similar to this one.",
    regionProvider: this._regionTypeParameter
  });

  this._dataParameter = new RegionDataParameter({
    terria: this.terria,
    catalogFunction: this,
    id: "data",
    name: "Characteristics",
    description: "The region characteristics to include in the analysis.",
    regionProvider: this._regionTypeParameter
  });

  this._parameters = [
    this._regionTypeParameter,
    this._regionParameter,
    this._dataParameter
  ];
}
1294972
function(flat) {
    return this.transform(function(acc, val, key) {
      var json = val.toJSON();
      acc[key] = flat && _.isArray(json) ? json[0] : json
    }, {});
  }
282349
function () {
        var json = ItemGroup.prototype.toJSON.apply(this);

        // move ids and stuff from root level to `info` object
        json.info = {
            _postman_id: this.id,
            name: this.name,
            version: this.version,
            schema: SCHEMA_URL
        };

        delete json.id;
        delete json.name;
        delete json.version;

        if (json.hasOwnProperty('description')) {
            json.info.description = this.description;
            delete json.description;
        }

        return json;
    }
191526
def json(self,attribs =None, recurse=True, ignorelist=False):
        """"""
        if not attribs: attribs = {}
        if self.idref:
            attribs['id'] = self.idref
        return super(AbstractTextMarkup,self).json(attribs,recurse, ignorelist)
560944
function ( ) {
				return {
					"type" : "Feature",
					"geometry" : {
						"type" : "Point",
						"coordinates" : [ this.getLatLng().lng, this.getLatLng().lat ]
					},	
					"properties" : {
						"text" : this.options.text ? this.options.text : "",
						"address" : this.options.address ? this.options.address : "",
						"phone" : this.options.phone ? this.options.phone : "",
						"url" : this.options.url ? this.options.url : "",
						"categoryId" : this.options.pinCategory.CategoryId ? this.options.pinCategory.CategoryId : "",
						"distance" : this.options.distance ? this.options.distance : 0
					}
				};
			}
1039222
def _api_views(self, plugin):
        
        response.content_type = 'application/json; charset=utf-8'

        if plugin not in self.plugins_list:
            abort(400, "Unknown plugin %s (available plugins: %s)" % (plugin, self.plugins_list))

        # Update the stat
        # self.__update__()

        try:
            # Get the JSON value of the stat views
            ret = self.stats.get_plugin(plugin).get_views()
        except Exception as e:
            abort(404, "Cannot get views for plugin %s (%s)" % (plugin, str(e)))
        return ret
1179940
function getJSON(url){
    url = encodeURI(url);
    var xhr = typeof XMLHttpRequest !== 'undefined' ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');

    var responseTypeAware = 'responseType' in xhr;

    xhr.open('GET', url, true);
    if (responseTypeAware) {
        xhr.responseType = 'json';
    }

    var daRequest = new Promise(function(resolve, reject){
        xhr.onreadystatechange = function(){
            var result;
            if (xhr.readyState === 4) {
                try {
                    result = responseTypeAware ? xhr.response : JSON.parse(xhr.responseText);
                    resolve(result);
                } catch (e){
                    reject(e);
                }
            }
        };
    });

    xhr.setRequestHeader('Content-type', 'application/json; charset=UTF-8');
    xhr.send();
    return daRequest;
}
128717
function(terria, map) {
  GlobeOrMap.call(this, terria);

  /**
   * Gets or sets the Leaflet {@link Map} instance.
   * @type {Map}
   */
  this.map = map;

  this.scene = new LeafletScene(map);

  /**
   * Gets or sets whether this viewer _can_ show a splitter.
   * @type {Boolean}
   */
  this.canShowSplitter = true;

  /**
   * Gets the {@link LeafletDataSourceDisplay} used to render a {@link DataSource}.
   * @type {LeafletDataSourceDisplay}
   */
  this.dataSourceDisplay = undefined;

  this._tweens = new TweenCollection();
  this._tweensAreRunning = false;
  this._selectionIndicatorTween = undefined;
  this._selectionIndicatorIsAppearing = undefined;

  this._pickedFeatures = undefined;
  this._selectionIndicator = L.marker([0, 0], {
    icon: L.divIcon({
      className: "",
      html:
        '<img src="' +
        selectionIndicatorUrl +
        '" width="50" height="50" alt="" />',
      iconSize: L.point(50, 50)
    }),
    zIndexOffset: 1, // We increment the z index so that the selection marker appears above the item.
    interactive: false,
    keyboard: false
  });
  this._selectionIndicator.addTo(this.map);
  this._selectionIndicatorDomElement = this._selectionIndicator._icon.children[0];

  this._dragboxcompleted = false;
  this._pauseMapInteractionCount = 0;

  this.scene.featureClicked.addEventListener(
    featurePicked.bind(undefined, this)
  );

  var that = this;

  // if we receive dragboxend (see LeafletDragBox) and we are currently
  // accepting a rectangle, then return the box as the picked feature
  map.on("dragboxend", function(e) {
    var mapInteractionModeStack = that.terria.mapInteractionModeStack;
    if (
      defined(mapInteractionModeStack) &&
      mapInteractionModeStack.length > 0
    ) {
      if (
        mapInteractionModeStack[mapInteractionModeStack.length - 1]
          .drawRectangle &&
        defined(e.dragBoxBounds)
      ) {
        var b = e.dragBoxBounds;
        mapInteractionModeStack[
          mapInteractionModeStack.length - 1
        ].pickedFeatures = Rectangle.fromDegrees(
          b.getWest(),
          b.getSouth(),
          b.getEast(),
          b.getNorth()
        );
      }
    }
    that._dragboxcompleted = true;
  });

  map.on("click", function(e) {
    if (!that._dragboxcompleted && that.map.dragging.enabled()) {
      pickFeatures(that, e.latlng);
    }
    that._dragboxcompleted = false;
  });

  this._selectedFeatureSubscription = knockout
    .getObservable(this.terria, "selectedFeature")
    .subscribe(function() {
      selectFeature(this);
    }, this);

  this._splitterPositionSubscription = knockout
    .getObservable(this.terria, "splitPosition")
    .subscribe(function() {
      this.updateAllItemsForSplitter();
    }, this);

  this._showSplitterSubscription = knockout
    .getObservable(terria, "showSplitter")
    .subscribe(function() {
      this.updateAllItemsForSplitter();
    }, this);

  map.on("layeradd", function(e) {
    that.updateAllItemsForSplitter();
  });

  map.on("move", function(e) {
    that.updateAllItemsForSplitter();
  });

  this._initProgressEvent();

  selectFeature(this);
}
1365271
function(terria) {
  ImageryLayerCatalogItem.call(this, terria);

  /**
   * Gets or sets the outline color of the features, specified as a CSS color string.
   * @type {String}
   * @default '#000000'
   */
  this.lineColor = "#000000";

  /**
   * Gets or sets the fill color of the features, specified as a CSS color string.
   * @type {String}
   * @default 'rgba(0,0,0,0)'
   */
  this.fillColor = "rgba(0,0,0,0)";

  /**
   * Gets or sets the name of the layer to use the Mapbox vector tiles.
   * @type {String}
   */
  this.layer = undefined;

  /**
   * Gets or sets the name of the property that is a unique ID for features.
   * @type {String}
   * @default 'FID'
   */
  this.idProperty = "FID";

  /**
   * Gets or sets the name of the property from which to obtain the name of features.
   * @type {String}
   */
  this.nameProperty = undefined;

  /**
   * Gets or sets the maximum zoom level for which tile files exist.
   * @type {Number}
   * @default 12
   */
  this.maximumNativeZoom = 12;

  /**
   * Gets or sets the maximum zoom level that can be displayed by using the data in the
   * {@link MapboxVectorTileCatalogItem#maximumNativeZoom} tiles.
   * @type {Number}
   * @default 28
   */
  this.maximumZoom = 28;

  /**
   * Gets or sets the minimum zoom level for which tile files exist.
   * @type {Number}
   * @default 0
   */
  this.minimumZoom = 0;
  this._legendUrl = undefined;

  knockout.track(this, [
    "lineColor",
    "fillColor",
    "layer",
    "idProperty",
    "nameProperty",
    "_legendUrl"
  ]);

  overrideProperty(this, "legendUrl", {
    get: function() {
      if (defined(this._legendUrl)) {
        return this._legendUrl;
      } else {
        return new Legend({
          items: [
            {
              color: this.fillColor,
              lineColor: this.lineColor,
              title: this.name
            }
          ]
        }).getLegendUrl();
      }
    },
    set: function(value) {
      this._legendUrl = value;
    }
  });
}
1123195
def json_data(self, instance, default=[]):
        
        value = self.get(instance)
        out = map(api.get_url_info, value)
        return out or default
318137
function() {
		let obj = {}, 
			key = null, 		// property key
			extended = false, 	// whether the is extended Mark object or legacy JSON object
			index = 0;
		
		let putText = function(text) {
			// check preceding node
			if (index > 0 && typeof obj[index-1] === 'string') {
				// merge with previous text
				obj[index-1] += text;
			} else {
				Object.defineProperty(obj, index, {value:text, writable:true, configurable:true}); // make content non-enumerable
				index++;
			}
		},
		parseContent = function() {
			while (ch) {
				if (ch === '{' || ch === '(' || ch === '[' && text[at] === '#') { // child object
					let child = (ch === '(') ? pragma(obj) : (ch === '[' ? binary(obj):object(obj));  
					Object.defineProperty(obj, index, {value:child, writable:true, configurable:true}); // make content non-enumerable
					// all 4 types: Mark object, JSON object, Mark pragma, Mark binary store reference to parent 
					child[$parent] = obj;  index++;  
				}
				else if (ch === '"' || ch === "'") { // text node
					let str = string();
					// only output non empty text
					if (str) putText(str);
				}
				else if (ch === '}') { 
					next();  obj[$length] = index;
					return;
				}
				else {
					error(UNEXPECT_CHAR + renderChar(ch));
				}
				white();
			}
			error(UNEXPECT_END);		
		};
		
		next();  white();  // skip the starting '{'
		while (ch) {
			if (ch === '}') { // end of the object
				next();  
				if (extended) { obj[$length] = index; }
				return obj;   // could be empty object
			}
			// scan the key
			if (ch === '{' || ch === '(' || ch === '[') { // child object, pragma or binary
				if (extended) {
					parseContent();  return obj;
				}
				error(UNEXPECT_CHAR + "'"+ ch +"'");
			}
			if (ch === '"' || ch === "'") { // quoted key
				var str = string();  white();
				if (ch === ':') { // property or JSON object
					key = str;
				} else {
					if (extended) { // already got type name
						// only output non-empty text
						if (str) putText(str);
						parseContent();  return obj;
					}
					else if (!key) { // at the starting of the object
						// create the object
						obj = MARK(str, null, null);
						extended = true;  // key = str;
						continue;							
					}
					else { 
						error(UNEXPECT_CHAR + renderChar(ch));
					}
				}
			}
			else { // if (ch==='_' || ch==='$' || 'a'<=ch && ch<='z' || 'A'<=ch && ch<='Z')
				// Mark unquoted key, which needs to be valid JS identifier.
				var ident = identifier();  white();
				if (ch == ':') { // property value
					key = ident;
				} else {
					if (!extended) { // start of Mark object
						obj = MARK(ident, null, null);
						extended = true;  // key = ident;
						continue;
					}
					error(UNEXPECT_CHAR + renderChar(ch));
				}
			}
			
			// key-value pair
			next(); // skip ':'
			var val = value();
			if (extended && !isNaN(key*1)) { // any numeric key is rejected for Mark object
				error("Numeric key not allowed as Mark property name");
			}
			if (obj[key] && typeof obj[key] !== 'function') {
				error("Duplicate key not allowed: " + key);
			}
			obj[key] = val;  white();
			// ',' is optional in Mark
			if (ch === ',') {
				next();  white();
			} 
		}
		error(UNEXPECT_END);
	}