Class: searchDirective directive:gmfSearch

gmf.searchDirective

new searchDirective(gmfSearchTemplateUrl)

A directive that allows to search and recenter on a selected result's feature. It can search in multiple GeoJSON datasources. It can filter and group results by a feature's property.

This directive uses the ngeo.FeatureOverlayMgr to create a feature overlay for drawing features on the map. The application is responsible to initialize the ngeo.FeatureOverlayMgr with the map.

Example flat results:

 <gmf-search gmf-search-map="ctrl.map"
   gmf-search-options="ctrl.searchOptions"
   gmf-search-styles="ctrl.searchStyles"
   gmf-search-datasources="ctrl.searchDatasources"
   gmf-search-coordinatesprojections="ctrl.searchCoordinatesProjections"
   gmf-search-clearbutton="true">
 </gmf-search>
 <script>
   (function() {
     let module = angular.module('app');
     module.value('fulltextsearchUrl', '${request.route_url('fulltextsearch', _query={"limit": 20}) | n}');
     module.value('gmfSearchGroups', []);
     module.constant('gmfSearchActions', [
           {action: 'add_theme', title: 'Add a theme'},
           {action: 'add_group', title: 'Add a sub theme'},
           {action: 'add_layer', title: 'Add a layer'}
     ]);
   })();
 </script>

Example with categories:

 <gmf-search gmf-search-map="ctrl.map"
   gmf-search-options="ctrl.searchOptions"
   gmf-search-styles="ctrl.searchStyles"
   gmf-search-datasources="ctrl.searchDatasources"
   gmf-search-coordinatesprojections="ctrl.searchCoordinatesProjections"
   gmf-search-clearbutton="true">
   gmf-search-colorchooser="true">
 </gmf-search>
 <script>
   (function() {
     let module = angular.module('app');
     module.value('fulltextsearchUrl', '${request.route_url('fulltextsearch', _query={"limit": 30, "partitionlimit": 5}) | n}');
     module.value('gmfSearchGroups', ${dumps(fulltextsearch_groups) | n});
     module.value('gmfSearchActions', []);
   })();
 </script>
HTML attributes:
Name Type Description
gmf-search-input-value The input value (read only).
gmf-search-map The map.
gmf-search-options Addition Typeahead options.
gmf-search-datasource The datasources.
gmf-search-styles A map of styles to apply on searched features. Keys must be the 'layer_name' propertie of features except for coordinates where the key ifor its style is the value of the constant 'gmf.COORDINATES_LAYER_NAME'. The 'default' key is used to apply the default style.
gmf-search-coordinatesprojections codes of supported projections for coordinates search (projections must be defined in ol3). If not provided, only the map's view projection format will be supported.
gmf-search-clearbutton The clear button.
gmf-search-colorchooser Whether to let the user change the style of the feature on the map. Default is false.
gmf-search-listeners The listeners.
gmf-search-maxzoom The maximum zoom we will zoom on result, default is 16.
gmf-search-on-init Optional function called when the directive is initialized.
Returns:
angular.Directive

The Directive Definition Object.