WebGIS Discussions

Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Super Contributor
Posts: 301
Registered: ‎02-09-2016

Re: Configuring the Template in Consumer Portal Layout - WMPS search

HI Jan,


Thank you for confirming that. I thought it didn't work because I didn't do it right.


Kind regards,

Occasional Contributor
Posts: 12
Registered: ‎01-03-2018

Re: Configuring the Template in Consumer Portal Layout - WMPS search

Well, after following all the thread instructions, i finally success on creating WMPS Searches, configure them, and even after a few try/error i succeed in personalize all the tooltips, results, and detailed info.

Let me resume it, so maybe it can help someone.


At SearchConfiguration, i selected:

WMPS Search Attributes.png --> WMPS Search Attributes filled.png


The 'Search Result Type' and 'Feature Attribute' corresponds to data.properties.type and data.properties.description fields, of every future result element you get from your search.


So you can select a 'Search Result Type' field from your feature, knowing for example in my case, that  CAPA_GENERICA, is an attribute where will be some "Restaurants"


Fields Values.PNG


and configure the template.json like this:


template json with restaurants.png

In the green section, "wmpssearch" is DEFAULT behaviour for WMPS Searches results. In there, the "default" subsection (in orange) refears to default behaviour for tooltip, resultlist and detailed, but the "restaurants" is the behaviour for every element that has a data.properties.type = "restaurants".


Like this, you can create new .tmpl files, refer them in new "type" section, according to Search Result Type field values you have in the choosen field, and configure specific tmpl files, depending on the values/types you have.


The values you can show, as JAN said, are available in a collection of attributes.

Every element has the following structure:




               "id" : "",
               "properties" : {
                              "name" : "",
                              "description" : "",
                              "type" : "",
                              "original" : {
                                            "Attributes" : [{key, value}]
                              "serviceType" : "WMPSSearch",
                              "x1" : XMin,
                              "x2" : Xmax,
                              "y1" : YMin,
                              "y2" : YMax
               "geometry" : {
                              "coordinates" : [X, Y],
                              "type" : "Point"
               "type" : "Feature",
               "crs" : {
                              "type" : "name",
                              "properties" : {
                                            "name" : "EPSG:XXXX"



so, on data.properties.original.Attributes[i], you have all the attributes and properties from your FeatureElement.

Here I show you for example some of my "basic" tooltips:



<div class="webgis-search-result-marker-tooltip-type-<%=(data.properties.type || 'none').toLowerCase()%>">
    <div class="webgis-search-result-marker-tooltip-item webgis-search-result-marker-tooltip-item-description"><%=data.properties.description%></div>
    <div class="webgis-search-result-marker-tooltip-item webgis-search-result-marker-tooltip-item-type"><%=data.properties.original.Attributes[2].Value%></div>
	<div class="webgis-search-result-marker-tooltip-item webgis-search-result-marker-tooltip-item-type"><%=data.properties.original.Attributes[3].Value%></div>
	<br />
	<% _.forOwn(data.properties.original.Attributes, function(value, key) { %>
	  <% if(value.Key != "GEOMETRIA" && value.Key != "COORD_X" && value.Key != "COORD_Y" && value.Value != "" && value.Value != undefined) { %>
	  <%=value.Key%> : <%=value.Value%>
	  <br />
	  <% } %>
	<br />

and the result is something like this:


tooltip default.png


or more simple, in the "restaurants" case (restaurants.tooltip.tmpl)


<div class="webgis-search-result-marker-tooltip-type-<%=(data.properties.type || 'none').toLowerCase()%>">
    <div class="webgis-search-result-marker-tooltip-item webgis-search-result-marker-tooltip-item-description"><%=data.properties.original.Attributes[8].Value%></div>
	<br />
	<div class="webgis-search-result-marker-tooltip-item webgis-search-result-marker-detail-item-info-telf">Telf: <%=data.properties.original.Attributes[10].Value%></div>
	<div class="webgis-search-result-marker-tooltip-item webgis-search-result-marker-tooltip-item-type">Adr: <%=data.properties.original.Attributes[14].Value%></div>
	<br />


and the result is something like this:


tooltip restaurants.png


They are both from same WMPS Search, but diferent element types, the first one is the default tooltip, the second one is a Restaurant type result.




All the .tmpl files, has a div class references, so you can change the style, changing the CSS file:



Adding new CSS styles or modifying the webgis-search-result-marker-tooltip-item styles you need.