Geoportal Search Widget for Silverlight

Geoportal Search Widget for Silverlight

The Geoportal Search Widget for Silverlight allows users to search other geoportals from within a Silverlight Viewer.

How to Use

The ArcGIS API for MIcrosoft Silverlight/WPF allows for the creation of Rich Internet applications on top of ArcGIS Server. The API is built on the free Microsoft Silverlight framework. ESRI provides a sample viewer templates that can be integrated with the Geoportal extension, using the Geoportal Search Widget for Silverlight. For instructions on how to add the Geoportal Search Widget to your existing sample viewer, see the Add the Geoportal Widget to an Existing Silverlight Viewer section below.

The Geoportal extension ships with an example viewer that is preconfigured with the Geoportal Search Widget for Silverlight. To launch the example viewer, go to the examples page (http://server_name/geoportal/widgets/example.jsp) and launch the Silverlight Viewer from the link on the page. The Find GIS Data window will automatically be opened when the application is launched; this Find GIS Data window is the Geoportal Search Widget for Silverlight.

How to search

Notice that the Find GIS Data window has one input field, a Search button, and three radio buttons. The input field accepts any lucene search query. You can type in a simple query, such as just one keyword to search, or you can develop more complex queries using the Lucene syntax. Furthermore, you can limit search results to a certain spatial extent. Select the appropriate radio button: Anywhere means no spatial filter will be applied, Intersecting will retrieve records that overlap the spatial extent currently shown in the Silverlight Viewer, and Fully Within will retrieve records where the spatial extent falls fully within the extent currently shown in the Silverlight Viewer.

Once you have entered the search criteria, click the Search button.

Search results matching your criteria are returned. Click on one of the records, and the interface zooms to the spatial extent of the resource. Another window appears, showing information for that search result resource and links that provide the same functionality that you'd see on the geoportal search page. You will notice that an Add to Map link appears for Live Data resources. That is because in this Silverlight application, users can preview the service when they chose to add it to the map with the Add to Map link.

Other tools in the Find Data window

The Silverlight widget allows you to turn off the bounding box extents for all records or individual records. Beside each search result title is a check box, by default it will be checked which means the bounding box for that record will be displayed on the map. You can uncheck the box and the bounding box will not display on the map. You could also check uncheck the box beside the number of documents found to remove all search result bounding boxes from the map.

If you close the window, but want to open it again, hover the pointer over the cube "Globe" icon in the viewer's main menu, and you will see the Find GIS Data tool display. Click on it to restore it to the Find GIS Data user interface.

Viewing a service in the interface

The example Silverlight Viewer provided with the Geoportal extension supports ArcIMS, ArcGIS Server REST services, OGC WMS, and GeoRSS. If a service is not running or is an unsupported service type, it will not appear on the map interface even though an Add to Map link is displayed with the search result.

How to Add the Geoportal Widget to an Existing Silverlight Viewer

The Silverlight Viewer that ships with the Geoportal extension is a sample. If you are hosting your own ESRI Silverlight Viewer and would like to add the Geoportal Search Widget to that application, you will need to acquire the source code package of the Geoportal. You can add the Geoportal Search Widget to your ESRI Silverlight Viewer by following the steps below.

  1. Reference GeoportalWidget.dll in your Silverlight map application project (this file is located in the source code distribution).
  2. Next you will have to add the GeoportalWidget control to your xaml page.
    • First add the code below to the <UserControl> tag
       xmlns : slptk ="clr-namespace:GeoportalWidget;assembly=GeoportalWidget"
    • Second add the control to the page similar to code below.
       < StackPanel Orientation ="Vertical">
      < slptk : GeoPortalMain x : Name ="GeoPortal1" Map ="{ Binding ElementName =MapView}" />
      </ StackPanel >
  3. Follow the steps on the ArcGIS API for Microsoft Silverlight/WPF page for the map viewer compiling instructions.
  4. Navigate to the [Your ESRI Silverlight Sample Viewer Root Directory]/clientBin folder, and open the geoportalWidgetConfig.xml file in a text editor. This file contains a number of settings you can specify to customize your Geoportal Search Widget. Most of these settings are optional, and are listed in the table below. Before configuring the optional settings, you must do the following:
    • Find the section shown below, and comment it out so it reads as follows:
      <!-- <gptEndpoint url="rest/find/document"
      name="Default Site"/> -->
    • Now, copy the next gptEndpoint element that describes the GEOSS portal URL, and paste it just below your commented text:
      <gptEndpoint
      url="http://geoss.esri.com/geoportal/rest/find/document?"
      name="GEOSS"/>
    • Edit the copied gptEndpoint element by changing the URL to point to your geoportal, and updating the 'name' attribute with the name of your geoportal. This will allow users to select your geoportal from the list of default sites to search. You can remove the GEOSS or GOS portals from the list by removing their gptEndpoint entries.
  5. If you desire to change the look and feel of your search widget or how it behaves, configure any of the following optional elements. Elements not listed in this table should not be altered:

    Element Name

    Description

    Accepted Values

    <label>

    refers to labels in the Search Widget. The value attribute is what the user sees. Do not change the name attribute.

    value should be a string

    <searchTimeout>

    max time in seconds a search will be allowed to run before it times out

    integer

    <addLayerTimeout>

    max time in seconds adding a layer will be allowed to run before it times out

    integer

    <iconSearch>

    filepath to the search icon in the Search Widget interface

    string

    <iconResult>

    filepath to the table icon in the Search Widget interface

    string

    <iconHelp>

    filepath to the help icon in the Search Widget interface

    string

    <zoomFactor>

    how much buffer to add to the view of the extent so that the borders of the extent and some surrounding area can be seen when you choose Zoom to Extent for a search result

    integer

    <urlHelp>

    URL to the help webpage. You can update this to point to a file hosted by your organization. The default is the Geoportal extension's Search Widget help.

    URL string

    <color id="mainBboxesPlain">

    defines look and feel for bounding boxes showing the extent of returned search results

    variable - several parameters are defined here

    <color id="mainBboxesHighlight"

    defines look and feel for a highlighted bounding box showing the extent of a selected search result

    variable - several parameters are defined here

  6. The Silverlight viewer in order to access another site for information the site has to have a crossdomain.xml that defines access policy. To get around this restriction, the Geoportal Search Widget for Silverlight can use a proxy. If the proxy is not used, then all of the search and the map service endpoint domains must have a crossdomain.xml file explicitly allowing access from the domain the ESRI Silverlight Sample Viewer runs on. If the ESRI Silverlight Sample Viewer and the map services found are going to be on the same domain then a crossdomain file and/or a proxy is not needed and you can skip this step.

    • Example A: Replace proxy.jsp with the proxy.jsp from the Geoportal Example Silverlight Viewer

      • Overwrite the proxy.jsp file in your Flex Viewer root directory with the proxy.jsp file from the [Geoportal Install Directory]/Widgets folder.

    • Example B: Reference proxy.jsp

      • Copy the the proxy.jsp file from the [Geoportal Install Directory]/Widgets folder into one of your Java web applications.
      • Verify that your Silverlight Viewer is in the same domain as where you are hosting this proxy.jsp.
      • Open the geoportalWidgetConfig.xml file (from [Your Silverlight Viewer Root Directory]/Clientbin folder) and update the <useProxy> element's proxyUrl attribute with the following URL: "http://yourdomain/yourcontext/proxy.jsp?url=" . The updated element is shown below:
        <useProxy
        proxyUrl="http://yourdomain/yourcontext/proxy.jsp?url="></useProxy>
      • Change "yourdomain" to reference the server hosting your Silverlight Viewer, and change "yourcontext" to the web application hosting your proxy.jsp file.
      • Save the geoportalWidgetConfig.xml file.

  7. Launch your ESRI Silverlight Sample Viewer and try out the Geoportal Search Widget.

8/6/2012