Skip to content
Reinier Sterkenburg edited this page Mar 30, 2015 · 3 revisions

todo: review this description of the project file structure: Erik / Arnoud?

Here's a description of the main data structures in TNOCS and how they are associated with the projects.json and project.json files:

Solution (project.ts)

The Solution class has (among others) the following fields:

    baselayers: IBaseLayer[];
    projects  : SolutionProject[];

This data structure corresponds to what's in the projects.json file.

SolutionProject (project.ts)

Has the fields:

    title: string;
    url  : string;

In projects.json there's an array of instances of this class. The url refers to a project.json file, which contains an instance of a Project.

Project (project.ts)

Has the following fields:

    title           : string;
    description     : string;
    logo            : string;
    url             : string;
    activeDashboard : Dashboard;
    baselayers      : IBaseLayer[];
    featureTypes    : { [id: string]: IFeatureType }
    propertyTypeData: { [id: string]: IPropertyType }
    groups          : Array<ProjectGroup>;
    startposition   : Coordinates;
    features        : IFeature[];
    timeLine        : DateRange;
    mcas            : Mca.Models.Mca[];
    dashboards      : Dashboard[];
    dataSets        : DataSet[];
    viewBounds      : IBoundingBox;
    userPrivileges  : IPrivileges;
    languages       : ILanguageData;
    expertMode = Expertise.Expert;
    markers = {};

In project.json there's a json representation of an instance of this class.

Remarks:

  • Baselayers is also in Solution. I suspect it is redundant here. The project.json files I've seen don't contain baselayers.
  • groups normally contains one or more ProjectGroups. A ProjectGroup normally contains one or more layers.
  • I'd like to clarify how featureTypes and propertyTypeData are associated with the layers and the properties of the layers. Apparently there are "id" values that are used as keys. (It turns out that featureTypeId properties in GeoJson files are used as keys for featureTypes).

ProjectGroup (group.ts)

has, among others, the following fields:

    id              : string;
    title           : string;
    description     : string;
    layers          : Array<ProjectLayer>;
    filters         : Array<GroupFilter>;
    styles          : Array<GroupStyle>;
    oneLayerActive  : boolean;
    ndx             : any;
    filterResult    : IFeature[];
    styleProperty   : string;

An array of instances of this class is can be found in project.json (under the name “groups”).
The "id" field here does not seem to be used as key for featureTypes or propertyTypeData. Because in the project.json files I've seen so far, the "id" fields don't seem to be used.

ProjectLayer (project.ts)

has, among others, the following fields:

    /** Title as displayed in the menu */
    title                       : string;
    /** Description as displayed in the menu */
    description                 : string;
    /** Type of layer, e.g. GeoJSON, TopoJSON, or WMS */
    type                        : string;
    /** Data source */
    url                         : string;
    /** In case we keep the style information in a separate file */
    styleurl                    : string;
    /** WMS sublayers that must be loaded */
    wmsLayers                   : string;
    mapLayer                    : L.LayerGroup<L.ILayer>;
    /** Group of layers */
    group                       : ProjectGroup;
    id                          : string;
    reference                   : string;
    /** layer original source */
    data                        : JSON;

Here we also see a field "id". This "id" also does not seem to be used as key for featureTypes. At least, not if the json file (referred to by "data") contains features that have featureTypeId properties. Perhaps if there are no featureTypeId properties, "id" is used.
(todo: to be confirmed)

Layer Sources

Common Sense currently supports the following layer sources: wms, geojson, topojson and tilelayer. When you setup your project file, you can set the type for each of your layers.

WMS

GeoJSON

TopoJSON

Tilelayer

Dashboards