Adding an Add a New Server dialogΒΆ

In the Add Layers dialog, there will be a listing of layers as defined by the application. In the demo application, only the OpenStreetMap layer is available.

The Add Layers dialog is accessed by clicking the Add Layers button.

../../../_images/viewer_addlayersbutton.png

Click to open the Add Layers dialog

../../../_images/viewer_addlayersdialog.png

Add layers dialog showing one available layer

It is possible to add an additional dialog for specifying a new server. This allows for connecting to layers hosted on a WMS server different from what was specified in the application. To enable this functionality, two additions will need to be made to the application src/app/app.js file:

  1. Add the following dependency to the top of the file:

    * @require overrides/override-ext-ajax.js
    
  2. Add a proxy to the gxp.Viewer configuration:

    proxy: "<PROXY_URL>",
    

    substituting the location of the proxy for <PROXY_URL>. This proxy is necessary to bypass the Same Origin Policy when accessing remote resources through JavaScript.

  3. Restart the application. The dialog will be visible after clicking the Add Layers button. It is titled View available data from: and contains a list box.

    ../../../_images/viewer_addnewserverdialog.png

    Add Layers dialog containing Add a New Server

  4. Clicking on the list box and selecting Add a New Server will enable the user to enter a URL containing a WMS endpoint. The list of layers available through that endpoint will then be displayed.

    ../../../_images/viewer_addnewserver.png

    Adding a new server