Skip to content

Search Widget for HTML

mhogeweg edited this page Dec 26, 2012 · 3 revisions

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.

searchWidget1.png

Pop-up window displaying search results:

searchWidget2.png

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.

<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script>  
<script type="text/javascript" src="http://server_name/geoportal/widgets/searchjs.jsp"></script>

Additional Installation Options

Supported search option parameters are:

  • anchor (fieldset,button,link default is fieldset)
  • hasFramework (dojo framework is already loaded)
  • contentType (delimited list)
  • isPartOf (collection name)
  • max (max records to return, default = 30)
  • data category
  • bbox
  • spatial relationship: such as intersect
  • publisher
  • source: harvesting site id
  • orderBy
  • after: published after
  • before: published before
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 you are interested in using the advanced search options and 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.


Back to Geoportal Clients for ArcGIS
Clone this wiki locally