I would like to set the geocoder to zoom to 1:1200. I think I would change the expand.0.0625 for the Point geometry but I am not sure.
if (feature) { var resultGeometry = feature.geometry; if (resultGeometry.type === 'point') { anchorPoint = resultGeometry; zoomExtent = this.map.extent.centerAt(anchorPoint).expand(0.0625); } else if (resultGeometry.type === 'polyline') { anchorPoint = resultGeometry.getPoint(0, 0); zoomExtent = resultGeometry.getExtent().expand(1.1); } else if (resultGeometry.type === 'polygon') { anchorPoint = resultGeometry.getCentroid(); zoomExtent = resultGeometry.getExtent().expand(1.1); } else if (resultGeometry.type === 'mulitpoint') { anchorPoint = resultGeometry.getPoint(0); zoomExtent = resultGeometry.getExtent().expand(1.1); } else { anchorPoint = resultGeometry; zoomExtent = this.map.extent; }
Solved! Go to Solution.
Pulaski Area GIS,
Well this took some figuring....
Make these changes and you should be able to get the point geocode to use a different scale (assuming that 1200 is different from what is already returning, I tested with a larger scale 4513.988705).
in the showResults function (line one is very important):
geocoder.autoNavigate = false; if (resultGeometry.type === 'point') { anchorPoint = resultGeometry; //zoomExtent = this.map.extent.centerAt(anchorPoint).expand(0.0625); this.map.setScale(4513.988705); this.map.centerAt(anchorPoint); }
In the setupInfoWindowAndZoom function change the single line for:
this.map.setExtent(newExtent);
to
if(geocodeResult.feature && geocodeResult.feature.geometry.type !== 'point'){ this.map.setExtent(newExtent); }
Pulaski Area GIS,
change the point logic something like this:
zoomExtent = this.map.extent.centerAt(anchorPoint);
this.map.setScale(1200);
if (feature) { var resultGeometry = feature.geometry; if (resultGeometry.type === 'point') { anchorPoint = resultGeometry; zoomExtent = this.map.extent.centerAt(anchorPoint);this.map.setScale(1200); } else if (resultGeometry.type === 'polyline') { anchorPoint = resultGeometry.getPoint(0, 0); zoomExtent = resultGeometry.getExtent().expand(1.1); } else if (resultGeometry.type === 'polygon') { anchorPoint = resultGeometry.getCentroid(); zoomExtent = resultGeometry.getExtent().expand(1.1); } else if (resultGeometry.type === 'mulitpoint') { anchorPoint = resultGeometry.getPoint(0); zoomExtent = resultGeometry.getExtent().expand(1.1); } else { anchorPoint = resultGeometry; zoomExtent = this.map.extent; }
I tried this but did get any result in the app.
Pulaski Area GIS,
Make sure you are changing the widget.js for the Geocoder widget in the particular app you are testing. If you make the change in the client stemapp folder then you will only see the change in a new app.
I checked that, still see no change in the zoom levels. Thanks for the help.
Pulaski Area GIS,
Well this took some figuring....
Make these changes and you should be able to get the point geocode to use a different scale (assuming that 1200 is different from what is already returning, I tested with a larger scale 4513.988705).
in the showResults function (line one is very important):
geocoder.autoNavigate = false; if (resultGeometry.type === 'point') { anchorPoint = resultGeometry; //zoomExtent = this.map.extent.centerAt(anchorPoint).expand(0.0625); this.map.setScale(4513.988705); this.map.centerAt(anchorPoint); }
In the setupInfoWindowAndZoom function change the single line for:
this.map.setExtent(newExtent);
to
if(geocodeResult.feature && geocodeResult.feature.geometry.type !== 'point'){ this.map.setExtent(newExtent); }
Robert,
This worked but the Image is not refreshing on zoom. Any thoughts?
Thanks
Pulaski Area GIS,
but the Image is not refreshing on zoom
??? What image?
Are there any errors in the web console?
Sorry, the basemap is not refreshing to the new scale. I have one console error but is was there before, I started this.
Pulaski Area GIS,
Make sure that you are setting a scale that is equal to one of your maps LODs.