Hello,
I am hoping this will be a pretty easy fix. Not so easy for me.
In using the Search widget we can type in a Parcel Address and zoom to that parcel. I would like to modify the zoom level because it goes in way too far for us.
I am in the configure portion for the Search widget. Unfortunately there is no place to change the Zoom Scale for my Parcel Address search source. I can modify the Name, Placeholder Text, Search Fields, Display Field, Maximum Suggestions, Maximum Results, etc...but nothing concerning scale. Am I looking in the right place?
Thanks
Jeff
Solved! Go to Solution.
Jeff,
That exact code works fine for me. Do you parcels take a long time to draw on the map? There must be some other factor that I don't have on my end that is affecting you.
Robert,
At the default screen our parcels our off at a scale beyond 1:15000. Once we zoom to the parcel they click right in pretty fast.
Robert,
So strange. I've tried different scenarios. If you type in new addresses each time the zoom level is perfect. What's interesting is...that while it is cycling and not going to the former location after panning away...is that it really has selected the parcel. When I go out to the default extent the parcel is highlighted and the pop-up window is open.
Does that additional information imply something?
Thanks.
Jeff
Jeff,
Nope that does not. Without being able to duplicate this I am at a loss on how to help.
Robert,
I don't know if this means anything but my code within the _onSelectResult is slightly different than what you have demonstrated before as a link to a previous conversation. Specifically, mine contains the following additional entries (see bold). Could these be contributing to the issue somehow?
_onSelectResult: function(e) {
var result = e.result;
if (!(result && result.name)) {
return;
}
var dataSourceIndex = e.sourceIndex;
var sourceResults = this.searchResults[dataSourceIndex];
var dataIndex = 0;
var that = this;
var getGraphics = function(layer, fid) {
var graphics = layer.graphics;
var gs = array.filter(graphics, function(g) {
return g.attributes[layer.objectIdField] === fid;
});
return gs;
};
var showPopupByFeatures = function(features) {
var location = null;
that.map.infoWindow.setFeatures(features);
if (features[0].geometry.type === "point") {
location = features[0].geometry;
} else {
location = features[0].geometry.getExtent().getCenter();
}
that.map.infoWindow.show(location, {
closetFirst: true
});
};
for (var i = 0, len = sourceResults.length; i < len; i++) {
if (jimuUtils.isEqual(sourceResults, result)) {
dataIndex = i;
break;
}
}
query('li', this.searchResultsNode)
.forEach(lang.hitch(this, function(li) {
html.removeClass(li, 'result-item-selected');
var title = html.getAttr(li, 'title');
var dIdx = html.getAttr(li, 'data-index');
var dsIndex = html.getAttr(li, 'data-source-index');
if (title === result.name &&
dIdx === dataIndex.toString() &&
dsIndex === dataSourceIndex.toString()) {
html.addClass(li, 'result-item-selected');
}
}));
var pt = result.feature.geometry.getCentroid();
if(this.map.getLevel() !== 5){
this.map.centerAndZoom(pt, 5); //Change this to suit your needs
}else{
this.map.centerAt(pt);
}
Jeff,
No that is just newer code that esri has added in a later release then the one that I originally wrote this about. I am using 2.3 when I am testing and what you have in bold is the same in 2.3
Robert,
I see. Our WAB Developers Edition is 2.2. I don’t know if that would have any bearing on this issue or not. I know you are a vast wealth of information and help on just about everything I have been doing to upgrade our current system…but do you think it would be prudent for me to repost my issue to see if anyone else has had similar issues? I wanted to ask you first so it didn’t seem like I was dismissing your assistance in the slightest.
Thanks.
Jeff
Jeff,
Normally if other had any input they would chimed in, but you can try re posting.
Robert,
It appears you are indeed correct. No one has replied to my reposting.
Thanks again for all your help. I could never have made it as far as I did without your assistance. I will continue to investigate our system for other issues that could be affecting the script outcome.
Jeff