Select to view content in your preferred language

URL to zoom to feature

5303
9
02-23-2017 08:34 AM
BBulla
by
Regular Contributor

Hi,

Is it possible to modify the URL to zoom to a specific feature?  I've read some ideas about using ?feature= (or possibly even ?query= will do what I need it to do) but nothing actually works on the WebApp I am trying.

I am trying something like this:

http://<an internal weblink/?feature=Land_3324_1;CONTRACTNO;D2015-025

In the WebApp this particular layer is set as a "Search" layer, but there are lots of other layers set as search layers too, so using ?find= seems to work a little too slowly.

Thanks!

0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Emeritus

B Bulla,

The use of ?feature is not supported in WAB.

Use URL parameters—Web AppBuilder for ArcGIS | ArcGIS 

Query or Find are your only options.

Tip:

Now there is a way to construct URL parameters interactively. Add the Share widget in the app and click Link Options. Choose the Query a feature and zoom to it option and select the layer, field, and field value you want to query against. Copy the URL in Link preview which contains the url parameters you specified. Remove the Share from the app if not needed.

BBulla
by
Regular Contributor

Hi Robert,

I think part of my problem is determining the proper Layer ID for the layer I need to zoom into for the ?query to work.  We use group layer in the web map I am working with.  See below for a sample.  The layer I am aiming for is called "Contract Boundary" in the group "Land (Easements, Contract Boundaries)".  I have attached a copy of the json from when I use this URL to try and figure out the Layer IDs for my webmap:

/sharing/rest/content/items/24cb8e667d734c18afe5ee7d638b7b07/data/?f=pjson

Using this is not working:  ?query=Land%20(Easements,%20Contract%20Boundaries)_1,%20CONTRACTNO,%20D2015-027

I did try using the "Share" tool, but the URL seems to change with each variable that gets modified.  I'm trying to open this URL from an Access database, where I have a bunch of Contract Numbers (CONTRACTNO) that have defined boundaries within the webmap.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

B Bulla,

   The query portion of the url should be simple and look something like this:

&query=Census_8491,POP2000,1211537

Where Census_8491 is the layer id from the json response when you use /sharing/rest/content/items/24cb8e667d734c18afe5ee7d638b7b07/data/?f=pjson

Also notice there is no need for the spaces you have in your url following the commas.

so something like:

?query=Land_Boundaries_1234,CONTRACTNO,D2015-027

Now Land_Boundaries_1234 is just my example quess at the layers actual id.

0 Kudos
BBulla
by
Regular Contributor

Hi Robert,

So I checked the config_Search.json file and the ID for the layer I want to query/find is 

http://image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer_1 

But using something like this is still not working:

?query=http://image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer_1,CONTRACTNO,D2012-032

Is it possible that the Web App was created with an older version of WAB and hence not compatible with the ?query or ?find parameter??

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

B Bulla,

   By no means is the layers id "image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer_1" that is the url not the unique id that is assigned to the layer by the web map.

Since the layer name can be changed, it is strongly recommended that you use the layer ID in the query. You can retrieve the layer ID from the web map ID as shown here: http://<your portal url>/sharing/rest/content/items/32a83775654249dcae6b8f2eff5d4072/data/?f=pjson

0 Kudos
BBulla
by
Regular Contributor

Perhaps, but this is directly from the config_Search.json file:

{
"layerId": "http://image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer_1",
"url": "http://image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer/1",
"name": "Contract Boundaries",
"placeholder": "",
"searchFields": [
"CONTRACTNO"
],
"displayField": "CONTRACTNO",
"exactMatch": false,
"maxResults": 6,
"type": "query"
}

0 Kudos
BBulla
by
Regular Contributor

And using the URL above, the LayerID looks to be similar.  I too was expecting something like "Contract Boundary_6637", but this seems to be what it is.

{ "id": "http://image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer", "layerType": "ArcGISMapServiceLayer", "url": "http://image.durham.ca/ArcGIS/rest/services/Works/Land/MapServer", "visibility": false, "visibleLayers": [ ], "opacity": 1, "title": "Land (Easements, Contract Boundaries)", "layers": [ { "id": 0, "popupInfo": { "title": "Easement", "fieldInfos": [ { "fieldName": "OBJECTID", "label": "OBJECTID", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "INST_NO_S", "label": "INST_NO_S", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "INST_NO_W", "label": "INST_NO_W", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "PLAN", "label": "PLAN", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "CATERGORY", "label": "Category:", "tooltip": "", "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "RE_CODE", "label": "RE_CODE", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "TYPE", "label": "Type:", "tooltip": "", "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "TYPE2", "label": "TYPE2", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "MUNICIPALITY", "label": "Municipality", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "SEWER", "label": "Sewer:", "tooltip": "", "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "WATER", "label": "Water:", "tooltip": "", "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE", "label": "SHAPE", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE.AREA", "label": "SHAPE.AREA", "tooltip": "", "visible": false, "format": { "places": 2, "digitSeparator": true }, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE.LEN", "label": "SHAPE.LEN", "tooltip": "", "visible": false, "format": { "places": 2, "digitSeparator": true }, "stringFieldOption": "textbox" } ], "description": null, "showAttachments": true, "mediaInfos": [ ] } }, { "id": 1, "popupInfo": { "title": "Contract Boundary", "fieldInfos": [ { "fieldName": "OBJECTID", "label": "OBJECTID", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "CONTRACTNO", "label": "Contract Number:", "tooltip": "", "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "CONTRACTSTATUS", "label": "Contract Status:", "tooltip": "", "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE", "label": "Shape", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "SUB_PER", "label": "Substantial Performance:", "isEditable": false, "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "FINAL_ACCEP", "label": "Final Acceptance:", "isEditable": false, "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "SWAT", "label": "SWAT:", "isEditable": false, "visible": true, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE_Area", "label": "SHAPE_Area", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } }, { "fieldName": "SHAPE_STArea__", "label": "SHAPE.STArea()", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } }, { "fieldName": "SHAPE_STLength__", "label": "SHAPE.STLength()", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } }, { "fieldName": "SHAPE_Length", "label": "SHAPE_Length", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } } ], "description": null, "showAttachments": true, "mediaInfos": [ ] } }, { "id": 2, "popupInfo": { "title": "Depot Area: {DEPOTAREA}", "fieldInfos": [ { "fieldName": "OBJECTID", "label": "OBJECTID", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE", "label": "SHAPE", "tooltip": "", "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "DEPOTAREA", "label": "DEPOTAREA", "isEditable": false, "visible": false, "stringFieldOption": "textbox" }, { "fieldName": "SHAPE_STArea__", "label": "SHAPE.STArea()", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } }, { "fieldName": "SHAPE_STLength__", "label": "SHAPE.STLength()", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } }, { "fieldName": "SHAPE_Length", "label": "SHAPE_Length", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } }, { "fieldName": "SHAPE_Area", "label": "SHAPE_Area", "isEditable": false, "visible": false, "format": { "places": 2, "digitSeparator": true } } ], "description": null, "showAttachments": true, "mediaInfos": [ ] } } ] },

0 Kudos
BBulla
by
Regular Contributor

I also just tried to build a URL using the "Share" tool like you mentioned and the LayerID also appears to come up as a URL.  This is using the current version of WAB.

http://dwkts159.region.durham.local:3344/webappbuilder/apps/3/?query=http%3A%2F%2Fimage.durham.ca%2F... 

Could an older version of WAB not support ?query or ?find  ??

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

B Bulla,

  Query was not introduced till 2.1 or 2.2 I think.

0 Kudos