Select to view content in your preferred language

eSearch MultiQuery from 2 layers in same Map Service

705
6
08-30-2018 09:10 AM
ChipSimonds
Emerging Contributor

I have a rest service I would like to query using the eSearch Version 2.6.1.1. This service has two layers i want to query, if the data is not in one search the other. 

https://www.smithcountymapsite.org/publicgis/rest/services/Gallery/TaxParcelQuery/MapServer

Is this possible with the eSearch Widget using the dev version of wab 2.9?

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Chip,

   On that is not possible. The design of the eSearch widget to to only search a single layer in a MapService since it uses the esri QueryTask that is limited to one layer.

0 Kudos
ChipSimonds
Emerging Contributor

Robert,

I have now been able to get it to query two layers but now I am having issues with the symbology return on results.

One of the layers is a polygon and the other is a point. It will only see the first layer and returns the symbology of it not the second layer.

Chip Simonds | SCAD | 903.510.8643

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Maybe I did not understand your question then. Are you just wanting to have two layers setup to search but not at the same time? What do you mean you were able to do it?

0 Kudos
ChipSimonds
Emerging Contributor

No I want to search two layers from a single search query

https://www.smithcountymapsite.org/publicgis/rest/services/Gallery/TaxParcelQuery/MapServer/0

https://www.smithcountymapsite.org/publicgis/rest/services/Gallery/TaxParcelQuery/MapServer/1

In the eSearch config file I added this.

"MultiQuery": {

"enabled": true,

"grouplayers" : [

{

"url": "https://www.smithcountymapsite.org/publicgis/rest/services/Gallery/TaxParcelQuery/MapServer/0",

"expression": "UPPER(OWN1) LIKE UPPER('%[value]%') OR (ACCOUNT like '%[value]%'AND CHAR_LENGTH('[value]') > 10) or (PIN like '%[value]%'AND CHAR_LENGTH('[value]') >= 6)"

},

{

"url": "https://www.smithcountymapsite.org/publicgis/rest/services/Gallery/TaxParcelQuery/MapServer/1",

"expression": "UPPER(OWN1) LIKE UPPER('%[value]%') OR (ACCOUNT like '%[value]%'AND CHAR_LENGTH('[value]') > 10) or (PIN like '%[value]%'AND CHAR_LENGTH('[value]') >= 6)"

}

]

},

In the widget.js I added this.

var multiqueryUrl, multiqueryTask = null;;

if (this.config.layers[layerIndex].MultiQuery.enabled) {

adding = true;

//console.log('multilayer query enabled');

for (var i = 0, len = this.config.layers[layerIndex].MultiQuery.grouplayers.length; i < len; i++) {

multiqueryUrl = this.config.layers[layerIndex].MultiQuery.grouplayers.url;

multiqueryTask = new QueryTask(multiqueryUrl);

multiqueryTask.execute(queryParams, lang.hitch(this, this._onSearchFinish, layerIndex, closeOnComplete, removing, adding),

lang.hitch(this, this._onSearchError));

}

} else {

var queryTask = new QueryTask(layerConfig.url);

html.empty(this.divResultMessage);

html.place(html.toDom(this.nls.searching), this.divResultMessage);

queryTask.execute(queryParams, lang.hitch(this, this._onSearchFinish, layerIndex, closeOnComplete, removing, adding),

lang.hitch(this, this._onSearchError));

}

},

I am now able to search the two layers and return the result but they all show a polygon symbol instead of a point symbology since some are points(0).

Chip Simonds | SCAD | 903.510.8643

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Chip, this is because the widget is setup to produce one results layer and a layer can only have one geometry type. You would have to do a lot more coding to make the widget capable of handing searching multiple layers at once. Each layer search would need to produce it's own search results layer for starters.

0 Kudos
ChipSimonds
Emerging Contributor

Ok Robert, thank you, I will keep digging and hopefully find a way to do it.

Chip Simonds | SCAD | 903.510.8643

0 Kudos