Skip to content

Initialization Options

JacquiHand edited this page Oct 6, 2014 · 4 revisions

Initialization Options

Html5PivotViewer can be initialised with these options:

  • Loader: a loader that inherits from ICollectionLoader must be specified. Currently the project support loading collection in CXML format using the CXMLLoader or JSON format using the JSONLoader. Both take the URL of the collection as a parameter.
  • ImageController: Two image controllers are supported. The DeepZoomImageController and the SimpleImageController. The image controller used must match the format of the images of the items in the collection. I.e. use the DeepZoomImageController if you have images in the deepzoom format and the SimpleImageController if you have images in a format that can be drawn on an HTML5 canvas using the drawImage method e.g. jpeg, gif or png. This Option defaults to using the DeepZoom image controller if no controller is specified.
  • ViewerState: Sets the filters, selected item and chosen view when the PivotViewer first opens. See ViewerState Syntax for a description of the ViewerState.
  • MapService: which map service to use. This can be either Google or OpenStreetMap.
  • GeocodeService: which geocode service to use. This can either be Google or Nominatim.
  • GoogleAPIKey: required to use the Google map or geocode service.
  • MapOverlay: option to add a WMS overlay to the map. The base url of the WMS server should be supplied without the bbox option e.g. MapOverlay: http://maps.communities.gov.uk:8080/geoserver/eafloodareas/wms?service=WMS&version=1.1.0&request=GetMap&layers=FloodAlertsWarnings&styles=&srs=EPSG:4326&format=image%2Fjpeg

Example

In this example the PivotViewer.Models.Loaders.CXMLLoader is being used to open the collection at "samples/data/nigeria_state.cxml". The map view uses maps from OpenStreetMap and the Nominatim geocoding service. The ViewerState specifies that PivotViewer opens in the timeline view.

                    $('#pivotviewer').PivotViewer({ 
                        Loader: new PivotViewer.Models.Loaders.CXMLLoader("samples/data/nigeria_state.cxml"),
                        MapService: "OpenStreetMap",
                        GeocodeService: "Nominatim",
                        ViewerState: "$view$=5"
                    });

In this example the PivotViewer.Models.Loaders.JSONLoader is being used to open the collection at "samples/data/simple_ski.json". The collection is in JSON format so the JSONLoader is used and the images are jpegs so the SimpleImageController is used.

                    $('#pivotviewer').PivotViewer({ 
                        Loader: new PivotViewer.Models.Loaders.JSONLoader("samples/data/simple_ski.json"),
                        ImageController: new PivotViewer.Views.SimpleImageController()
                    });
Clone this wiki locally