How to use the terriajs/lib/Models/ShareDataService function in terriajs

To help you get started, we’ve selected a few terriajs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github magda-io / magda / magda-preview-map / index.js View on Github external
window.viewState = viewState;
}

// If we're running in dev mode, disable the built style sheet as we'll be using the webpack style loader.
// Note that if the first stylesheet stops being nationalmap.css then this will have to change.
if (process.env.NODE_ENV !== "production" && module.hot) {
    document.styleSheets[0].disabled = true;
}

terria
    .start({
        // If you don't want the user to be able to control catalog loading via the URL, remove the applicationUrl property below
        // as well as the call to "updateApplicationOnHashChange" further down.
        applicationUrl: window.location,
        configUrl: "config.json",
        shareDataService: new ShareDataService({
            terria: terria
        })
    })
    .otherwise(function(e) {
        raiseErrorToUser(terria, e);
    })
    .always(function() {
        try {
            configuration.bingMapsKey = terria.configParameters.bingMapsKey
                ? terria.configParameters.bingMapsKey
                : configuration.bingMapsKey;

            viewState.searchState.locationSearchProviders = [
                new BingMapsSearchProviderViewModel({
                    terria: terria,
                    key: configuration.bingMapsKey