new component_()
A component 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 component uses the ngeo.map.FeatureOverlayMgr
to create a
feature overlay for drawing features on the map. The application
is responsible to initialize the ngeo.map.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>
<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>
<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', []);
})();
</scriptrchUrl' value in the examples above set three "_query" parameters: "limit",
The 'fulltextsearchUrl' value in the examples above set three "_query" parameters: "limit", "partitionlimit" and "ranksystem". For this last one "ts_rank_cd" is the only effective value. It's used to order your search results with the "ts_rank_cd" ranking system from PostgreSQL module pg_trgm. Without this value, the PostgreSQL function "similarity" (module pg_trgm) is used for the ranking. Read the full-text search c2cgeoportal documentation to know more. You can also add these parameters to the "url" variable of one (or more) of the gmfx.SearchDirectiveDatasource given to this component (here within the "ctrl.searchDatasources"). That allows you to have multiples configurations on one search component.
HTML attributes:
Name | Type | Attributes | Description |
---|---|---|---|
gmf-search-input-value |
string | The input value (read only). | |
gmf-search-map |
ol.Map | The map. | |
gmf-search-options |
TypeaheadOptions | undefined | Addition Typeahead options. | |
gmf-search-datasource |
gmfx.SearchComponentDatasource | The datasources. | |
gmf-search-styles |
Object:.<string:, ol.style.Style:> | A map of styles to apply on searched features. Keys must be the 'layer_name' property 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 |
Array:.<string:> | 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-listeners |
ngeox.SearchComponentListeners | The listeners. | |
gmf-search-clearbutton |
boolean |
<optional> |
Optional clear button in the input search. Default to true. |
gmf-search-delay |
number |
<optional> |
Optional bloodhound request delay in ms. Default to 50 ms. |
gmf-search-colorchooser |
boolean |
<optional> |
Optional. Whether to let the user change the style of the feature on the map. Default is false. |
gmf-search-maxzoom |
number |
<optional> |
Optional maximum zoom we will zoom on result, default is 16. |
gmf-search-on-init |
function |
<optional> |
Optional function called when the component is initialized. |
gmf-search-action |
function |
<optional> |
Optional function called when no default action is defined. |