Skip to content

Composition schema

Raitis Berzins edited this page Jan 28, 2020 · 12 revisions

This is basic definition of composition json object also published in https://raw.githubusercontent.com/hslayers/hslayers-ng/develop/components/compositions/schema.json :

{
  "definitions": {},
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/hslayers/hslayers-ng/develop/components/compositions/schema.js",
  "type": "object",
  "title": "Schema of map compositions supported in Hslayers-ng",
  "required": [
    "abstract",
    "title",
    "extent",
    "projection",
    "layers"
  ],
  "properties": {
    "abstract": {
      "$id": "#/properties/abstract",
      "type": "string",
      "title": "Abstract",
      "default": "",
      "examples": [
        "Na mapě jsou zobrazené třídy ochrany půdy v Libereckém kraji"
      ],
      "pattern": "^(.*)$"
    },
    "name": {
      "$id": "#/properties/name",
      "type": "string",
      "title": "Same as #/properties/abstract for backwards compatibility",
      "default": "",
      "examples": [
        "Na mapě jsou zobrazené třídy ochrany půdy v Libereckém kraji"
      ],
      "pattern": "^(.*)$"
    },
    "title": {
      "$id": "#/properties/title",
      "type": "string",
      "title": "Title",
      "default": "",
      "examples": [
        "Třídy ochrany půdy"
      ],
      "pattern": "^(.*)$"
    },
    "extent": {
      "$id": "#/properties/extent",
      "type": "array",
      "title": "Composition extent in EPSG:4326",
      "items": {
        "$id": "#/properties/extent/items",
        "type": "string",
        "title": "Items",
        "default": "",
        "examples": [
          "14.62",
          "50.58",
          "15.42",
          "50.82"
        ],
        "pattern": "^(.*)$"
      }
    },
    "user": {
      "$id": "#/properties/user",
      "type": "object",
      "title": "User",
      "description": "Used in status manager but not in hslayers",
      "required": [
        "email",
        "name"
      ],
      "properties": {
        "email": {
          "$id": "#/properties/user/properties/email",
          "type": "string",
          "title": "Email",
          "default": "",
          "examples": [
            "dmitrii@seznam.cz"
          ],
          "pattern": "^(.*)$"
        },
        "name": {
          "$id": "#/properties/user/properties/name",
          "type": "string",
          "title": "Name",
          "default": "",
          "examples": [
            "Dmitrij Kožuch"
          ],
          "pattern": "^(.*)$"
        }
      }
    },
    "groups": {
      "$id": "#/properties/groups",
      "type": "object",
      "title": "Groups",
      "description": "Used in status manager but not in hslayers",
      "required": [
        "guest"
      ],
      "properties": {
        "guest": {
          "$id": "#/properties/groups/properties/guest",
          "type": "string",
          "title": "Guest",
          "default": "",
          "examples": [
            "r"
          ],
          "pattern": "^(.*)$"
        }
      }
    },
    "scale": {
      "$id": "#/properties/scale",
      "type": "number",
      "description": "Currently not supported in HsLayers",
      "title": "Scale",
      "default": 0,
      "examples": [
        1
      ]
    },
    "projection": {
      "$id": "#/properties/projection",
      "type": "string",
      "title": "Projection",
      "default": "",
      "examples": [
        "epsg:3857",
        "EPSG:4326"
      ],
      "pattern": "^(.*)$"
    },
    "center": {
      "$id": "#/properties/center",
      "type": "array",
      "title": "Center of composition",
      "description": "Currently not supported in HsLayers",
      "items": {
        "$id": "#/properties/center/items",
        "type": "number",
        "title": "Items",
        "default": 0,
        "examples": [
          1672068,
          6568819
        ]
      }
    },
    "units": {
      "$id": "#/properties/units",
      "type": "string",
      "title": "Units",
      "description": "Currently not supported in HsLayers",
      "default": "",
      "examples": [
        "degrees",
        "imperial",
        "nautical",
        "metric",
        "us"
      ],
      "pattern": "^(.*)$"
    },
    "layers": {
      "$id": "#/properties/layers",
      "type": "array",
      "title": "Layers",
      "items": {
        "$id": "#/properties/layers/items",
        "type": "object",
        "title": "Items",
        "required": [
          "metadata",
          "visibility",
          "title",
          "className"
        ],
        "properties": {
          "metadata": {
            "$id": "#/properties/layers/items/properties/metadata",
            "type": "object",
            "title": "Metadata"
          },
          "visibility": {
            "$id": "#/properties/layers/items/properties/visibility",
            "type": "boolean",
            "title": "Visibility",
            "default": false,
            "examples": [
              true
            ]
          },
          "base": {
            "$id": "#/properties/layers/items/properties/base",
            "type": "boolean",
            "title": "Base layer",
            "description": "Is the layer one of the base layers",
            "default": false,
            "examples": [
              true
            ]
          },
          "opacity": {
            "$id": "#/properties/layers/items/properties/opacity",
            "type": [
              "string",
              "number"
            ],
            "title": "Opacity",
            "default": "",
            "examples": [
              "1"
            ],
            "pattern": "^(.*)$"
          },
          "path": {
            "$id": "#/properties/layers/items/properties/path",
            "type": "string",
            "title": "Path of folder structure to group the layer into",
            "default": "",
            "examples": [
              "Climatic data/Time layers"
            ],
            "pattern": "^(.*)$"
          },
          "title": {
            "$id": "#/properties/layers/items/properties/title",
            "type": "string",
            "title": "Title",
            "default": "",
            "examples": [
              "Třídy ochrany půdy"
            ],
            "pattern": "^(.*)$"
          },
          "className": {
            "$id": "#/properties/layers/items/properties/className",
            "type": "string",
            "title": "Classname",
            "description": "Big type of layer. Currently all raster layers are wms layers and Vector layers are subdivided by protocol property",
            "default": "",
            "enum": [
              "HSLayers.Layer.WMS",
              "OpenLayers.Layer.Vector",
              "WMS",
              "WFS",
              "Vector",
              "XYZ"
            ],
            "examples": [
              "HSLayers.Layer.WMS"
            ],
            "pattern": "^(.*)$"
          },
          "singleTile": {
            "$id": "#/properties/layers/items/properties/singleTile",
            "type": "boolean",
            "title": "Single tile requests",
            "description": "Use single request to WMS provider to get map for the whole screen",
            "default": false,
            "examples": [
              true
            ]
          },
          "displayInLayerSwitcher": {
            "$id": "#/properties/layers/items/properties/displayInLayerSwitcher",
            "type": "boolean",
            "title": "Visibility of layer in layer switcher",
            "default": true,
            "examples": [
              true
            ]
          },
          "wmsMaxScale": {
            "$id": "#/properties/layers/items/properties/wmsMaxScale",
            "type": "number",
            "title": "Wmsmaxscale",
            "description": "Deprecated maxScale property used in old OpenLayers2. Is here just for historical reasons",
            "default": 0,
            "examples": [
              0
            ]
          },
          "legends": {
            "$id": "#/properties/layers/items/properties/legends",
            "type": "array",
            "title": "Legends",
            "items": {
              "$id": "#/properties/layers/items/properties/legends/items",
              "type": "string",
              "title": "Items",
              "default": "",
              "examples": [
                "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fpuda.map%26version%3D1.3.0%26service%3DWMS%26request%3DGetLegendGraphic%26sld_version%3D1.1.0%26layer%3Dtridyochrany%26format%3Dimage%2Fpng%26STYLE%3Ddefault"
              ],
              "pattern": "^(.*)$"
            }
          },
          "protocol": {
            "$id": "#/properties/layers/items/properties/protocol",
            "type": "object",
            "title": "Protocol",
            "properties": {
              "format": {
                "$id": "#/properties/layers/items/properties/protocol/properties/format",
                "type": "string",
                "enum": [
                  "ol.format.KML",
                  "ol.format.GeoJSON",
                  "hs.format.WFS",
                  "hs.format.Sparql"
                ],
                "title": "Layer procol format"
              },
              "url": {
                "$id": "#/properties/layers/items/properties/protocol/properties/url",
                "type": "string",
                "title": "URL to load geojson, kml and other data from"
              }
            }
          },
          "attribution": {
            "$id": "#/properties/layers/items/properties/attribution",
            "type": "object",
            "title": "Attribution",
            "properties": {
              "OnlineResource": {
                "$id": "#/properties/layers/items/properties/attribution/properties/OnlineResource",
                "type": "string",
                "title": "Url of layer attribution",
                "examples": [
                  "https://www.openstreetmap.org/copyright"
                ]
              },
              "Title": {
                "$id": "#/properties/layers/items/properties/attribution/properties/Title",
                "type": "string",
                "title": "Human readable attribution",
                "examples": [
                  "OpenStreetMap"
                ]
              }
            }
          },
          "features": {
            "$id": "#/properties/layers/items/properties/features",
            "type": "string",
            "title": "GeoJSON serialized feature collection",
            "default": null
          },
          "maxResolution": {
            "$id": "#/properties/layers/items/properties/maxResolution",
            "type": [
              "number",
              "null"
            ],
            "title": "Maxresolution",
            "default": "Number.Infinity",
            "examples": [
              8000
            ]
          },
          "minResolution": {
            "$id": "#/properties/layers/items/properties/minResolution",
            "type": [
              "number",
              "null"
            ],
            "title": "Minresolution",
            "default": 0,
            "examples": [
              0
            ]
          },
          "url": {
            "$id": "#/properties/layers/items/properties/url",
            "type": "string",
            "title": "Url of WMS service",
            "description": "WMS service URL. Vector layers which are loaded from file, see #/properties/layers/items/properties/protocol/properties/url property",
            "default": "",
            "examples": [
              "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fpuda.map%26"
            ],
            "pattern": "^(.*)$"
          },
          "params": {
            "$id": "#/properties/layers/items/properties/params",
            "type": "object",
            "title": "Params",
            "required": [
              "LAYERS"
            ],
            "properties": {
              "LAYERS": {
                "$id": "#/properties/layers/items/properties/params/properties/LAYERS",
                "type": "string",
                "title": "WMS Layer",
                "default": "",
                "examples": [
                  "tridyochrany"
                ],
                "pattern": "^(.*)$"
              },
              "FORMAT": {
                "$id": "#/properties/layers/items/properties/params/properties/FORMAT",
                "type": "string",
                "title": "Image format for WMS",
                "default": "",
                "examples": [
                  "image/png"
                ],
                "pattern": "^(.*)$"
              },
              "FROMCRS": {
                "$id": "#/properties/layers/items/properties/params/properties/FROMCRS",
                "type": "string",
                "title": "CRS used if serverside reprojection is needed",
                "default": "",
                "examples": [
                  "EPSG:3857"
                ],
                "pattern": "^(.*)$"
              },
              "VERSION": {
                "$id": "#/properties/layers/items/properties/params/properties/VERSION",
                "type": "string",
                "title": "Version",
                "default": "1.3.0",
                "examples": [
                  "1.3.0"
                ],
                "pattern": "^(.*)$"
              },
              "STYLES": {
                "$id": "#/properties/layers/items/properties/params/properties/STYLES",
                "type": "string",
                "title": "WMS Layer styles",
                "default": "",
                "examples": [
                  "default"
                ],
                "pattern": "^(.*)$"
              }
            }
          },
          "ratio": {
            "$id": "#/properties/layers/items/properties/ratio",
            "type": "number",
            "title": "Ratio of image requests",
            "description": "Not used by HsLayers yet. Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher.",
            "default": 1.5,
            "examples": [
              1.5
            ]
          },
          "projection": {
            "$id": "#/properties/layers/items/properties/projection",
            "type": "string",
            "title": "Projection of layer if it is different from the map projection for the whole application",
            "default": null,
            "examples": [
              "EPSG:4326"
            ]
          },
          "style": {
            "$id": "#/properties/layers/items/properties/style",
            "type": "object",
            "title": "Style of vector layer features",
            "description": "",
            "examples": [
              {
                "stroke": {
                  "color": "rgba(238, 156, 150, 1)",
                  "width": 23
                },
                "fill": {
                  "color": "rgba(238, 156, 150, 1)"
                }
              },
              {
                "stroke": {
                  "color": "rgba(238, 156, 150, 1)",
                  "width": 23
                },
                "image": {
                  "src": "data:image/svg+xml;base64,PHN2ZyB4bWxuc==",
                  "type": "icon"
                }
              }
            ]
          },
          "dimensions": {
            "$id": "#/properties/layers/items/properties/dimensions",
            "type": "object",
            "title": "Dimensions for layer like time, depth etc.",
            "description": "dimensions for tile requests. This is an object with properties named like the advertised WMTS dimensions.",
            "examples": [
              {
                "time": {
                  "name": "time",
                  "values": "2016-01-01T12:00:00.000Z/2018-01-01T12:00:00.000Z/PT24H"
                },
                "elevation": {
                  "name": "elevation",
                  "label": "depth",
                  "values": [
                    1,
                    100,
                    1000
                  ]
                }
              }
            ]
          }
        }
      }
    },
    "current_base_layer": {
      "$id": "#/properties/current_base_layer",
      "type": [
        "string",
        "null"
      ],
      "title": "Default base layer selected",
      "default": null,
      "properties": {
        "title": {
          "$id": "#/properties/current_base_layer/properties/title",
          "type": "string",
          "title": "Title",
          "default": "",
          "examples": [
            "OpenStreetMap"
          ],
          "pattern": "^(.*)$"
        }
      },
      "examples": [
        {
          "title": "OpenStreetMap"
        }
      ]
    }
  }
}

Example


{
	"abstract": "Na map\u011b jsou zobrazen\u00e9 t\u0159\u00eddy ochrany p\u016fdy v Libereck\u00e9m kraji",
	"title": "T\u0159\u00eddy ochrany p\u016fdy",
	"extent": ["14.62", "50.58", "15.42", "50.82"],
	"user": {
		"email": "dmitrii@seznam.cz",
		"name": "Dmitrij Ko\u017euch"
	},
	"groups": {
		"guest": "r"
	},
	"scale": 1,
	"projection": "epsg:3857",
	"center": [1672068, 6568819],
	"units": "m",
	"layers": [{
		"metadata": {},
		"visibility": true,
		"opacity": "1",
		"title": "T\u0159\u00eddy ochrany p\u016fdy",
		"className": "HSLayers.Layer.WMS",
		"singleTile": true,
		"wmsMaxScale": 0,
		"legends": ["https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fpuda.map%26version%3D1.3.0%26service%3DWMS%26request%3DGetLegendGraphic%26sld_version%3D1.1.0%26layer%3Dtridyochrany%26format%3Dimage%2Fpng%26STYLE%3Ddefault"],
		"maxResolution": null,
		"minResolution": 0,
		"url": "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fpuda.map%26",
		"params": {
			"LAYERS": "tridyochrany",
			"FORMAT": "image\/png",
			"FROMCRS": "EPSG:3857",
			"VERSION": "1.3.0"
		},
		"ratio": 1.5,
		"dimensions": {}
	}, {
		"metadata": {},
		"visibility": true,
		"opacity": 1,
		"title": "St\u00ednovan\u00fd model reli\u00e9fu",
		"className": "HSLayers.Layer.WMS",
		"singleTile": true,
		"maxResolution": null,
		"minResolution": 0,
		"url": "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Forto.map",
		"params": {
			"LAYERS": "stinovany_relief",
			"FORMAT": "image\/png",
			"ABSTRACT": "St\u00ednovan\u00fd model reli\u00e9fu Libereck\u00e9ho kraje"
		},
		"ratio": 1.5
	}, {
		"metadata": {},
		"visibility": true,
		"opacity": 1,
		"title": "Administrativn\u00ed \u010dlen\u011bn\u00ed",
		"className": "HSLayers.Layer.WMS",
		"singleTile": true,
		"maxResolution": null,
		"minResolution": 0,
		"url": "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fadministrativni_cleneni.map",
		"params": {
			"LAYERS": "administrativni_celky_hranice",
			"FORMAT": "image\/png",
			"ABSTRACT": "Administrativn\u00ed \u010dlen\u011bn\u00ed Libereck\u00e9ho kraje"
		},
		"ratio": 1.5
	}, {
		"metadata": {},
		"visibility": true,
		"opacity": 1,
		"title": "Jednoduch\u00e1 podkladov\u00e1 mapa",
		"className": "HSLayers.Layer.WMS",
		"singleTile": true,
		"maxResolution": null,
		"minResolution": 0,
		"url": "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fzabaged_2017_wms.map",
		"params": {
			"LAYERS": "podkladova_mapa",
			"FORMAT": "image\/png",
			"ABSTRACT": "Jednoduch\u00e1 podkladov\u00e1 mapa Libereck\u00e9ho kraje"
		},
		"ratio": 1.5
	}, {
		"metadata": {},
		"visibility": true,
		"opacity": 1,
		"title": "S\u00eddla",
		"className": "HSLayers.Layer.WMS",
		"singleTile": true,
		"maxResolution": null,
		"minResolution": 0,
		"url": "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fadministrativni_cleneni.map",
		"params": {
			"LAYERS": "definicni_body_administrativnich_celku",
			"FORMAT": "image\/png",
			"ABSTRACT": "Administrativn\u00ed \u010dlen\u011bn\u00ed Libereck\u00e9ho kraje"
		},
		"ratio": 1.5
	}],
	"current_base_layer": null
}
Clone this wiki locally