Web Layouts and Infrastructure Map Server Pages

An Infrastructure Map Server Page is any PHP, ASP.NET, or JSP page that makes use of the Infrastructure Map Server Web API. These pages are typically invoked by the Viewer or browser and when processed result in HTML pages that are loaded into a Viewer or browser frame. This is the form that will be used for most examples in this guide. It is possible, however, to create pages that do not return HTML or interact with the Viewer at all. These can be used for creating web services as a back-end to another mapping client or for batch processing of your data.

Creating an Infrastructure Map Server page requires initial setup, to make the proper connections between the Viewer, the page, and the Infrastructure Map Server site. Much of this can be done using Infrastructure Studio. Refer to the Studio Help for details.

One part of the initial setup is creating a web layout, which defines the appearance and available functions for the Viewer. When you define a web layout, you assign it a resource name that describes its location in the repository. The full resource name looks something like this:

Library://Samples/Layouts/SamplesPhp.WebLayout

When you open the web layout using a browser with the Basic Layout Viewer, the resource name is passed as part of the Viewer URL. Special characters in the resource name are URL-encoded, so the full URL would look something like this, (with line breaks removed):

http://localhost/mapserver2012/mapviewerajax/
?WEBLAYOUT=Library%3a%2f%2fSamples%2fSheboygan%2fLayouts%2f
SheboyganPhp.WebLayout

Part of the web layout defines commands and the toolbars and menus that contain the commands. These commands can be built-in commands, or they can be URLs to custom pages. The web layout also includes a URL to a home task that displays in the task pane. The home task can open other pages.

To create a new page and make it available as a command from the task list, do the following:

Note:
Custom pages are loaded by the Viewer page, so a relative URL for a custom page must start at the Viewer directory, then go up one level to reach the www directory. For example, a custom page located at www/samplesphp/index.php would use the following relative URL in the web layout
../samplesphp/index.php

It is also possible to add custom commands to the toolbar and the context menu using the same technique.

For most of the examples in this guide, however, the pages will be links from a home page loaded in the task pane frame.

Note:

Installing the package that comes with the Developer’s Guide samples creates a web layout automatically. The home task page of this layout contains links to examples that correspond to chapters in the Developer’s Guide.