Embed the Geoportal Search Widget for HTML in Another Page

Release 9.3.1 E-mail This Topic Printable Version Give Us Feedback

Embed the Geoportal Search Widget for HTML in Another Page

The Geoportal Search Widget for HTML can easily be included in other web pages or applications to enable searching the Geoportal. Users can type a search term or lucene search query in the search field, and retrieve a pop-up list of records that match that search. To see an example, access the geoportal's widget examples page, and enter a search term in the HTML widget interface that displays.



Search widget that appears on web page:







Pop-up window displaying search results:







How to Configure

Installing the Geoportal Search Widget for HTML consists of copying two lines of code and pasting it into the HTML page where you want the widget to appear. The first line of code references the JavaScript API that contains required tools for the search widget. The second line of code references the Geoportal catalog and provides the medium for searching. In the second line of code, replace "server_name" with your organization's Geoportal server.



<!-- Catalog Search Widget -->

<script type="text/javascript"

src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.3"></script>



<script type="text/javascript"

src="http://server_name/geoportal/widgets/searchjs.jsp"></script>




Additional Installation Options

If you want the search widget to show only certain search results when a user interacts with it, it is possible to customize the widget url to filter the search. Supported search filters are:



For example, to render the widget as a link and return only ten records, use the following link for the widget URL:



http://server_name/geoportal/widgets/searchjs.jsp?anchor=link&max=10



Or when wanting to search all content of the Geoportal for a certain geography, such as the State of Delaware, use the following link for the widget URL:



http://server_name/geoportal/widgets/searchjs.jsp?bbox=-79.71068%2C36.989765%2C-74.81832%2C40.659035&spatialRel=esriSpatialRelWithin



Tip: To determine the widget URL, perform the type of search in which you are interested using the geoportal's advanced search options on the geoportal web application's search page. Then look at the results as a GeoRSS feed. The URL that is displayed in the browser's address bar will show the proper values for the optional parameters listed above.



For Geoportal Implementations without Internet Access

The search widget references the JavaScript API, and the reference is by default the API hosted online. However, if the JavaScript API is installed locally, then this local reference can be used instead. Instructions for installing the JavaScript API locally are part of the ArcGIS JavaScript API product.