How-to add a layer search ========================= Search operations are only supported on ``vector``, ``geojson``, ``ags-vector``, ``wfs``, and ``mapserver-wfs`` map-source types. You can also add search operations to ``ags``, ``wms``, and ``mapserver`` mapsources using the query-as technique. Add a supported vector map-source --------------------------------- This how-to references the ``firestations`` source and ``fire_stations`` layer. For more information on setting those up in your local demo, read the:doc:`./add-a-layer` guide. This example creates a WFS-source for the Firestations layer. Add the following to ``mapbook.xml``: :: ./demo/firestations/firestations.map Configure a search service -------------------------- In ``app.js``, a new search service needs configured for that layer: .. code:: javascript // Add a search service app.registerService('search-firestations', SearchService, { // search only the firestations-wfs/fire_stations layer. searchLayers: ['firestations-wfs/fire_stations'], // Dak_GIS__4 stores the name of the Firestation's city. fields: [ {type: 'text', label: 'Station city', name: 'Dak_GIS__4'} ] }); Add the search service to the toolbar ------------------------------------- In the ``mapbook.xml``: 1. Find the ```` element. 2. Inside the ```` element, add the follow entry for the new search service: .. code:: xml