ArcGIS Server WebADF: Adjusting the Zoom Scale for Find Address Task Results

by James Richards July 02, 2009

Overview

When working with the Find Address Task in the ArcGIS Server WebADF, the default zoom scale that is displayed when the user zooms to a found address might not be what you want. This article discusses how to change it using the ZoomToPointFactor property. [more]

Background

Let’s assume that you have a WebADF application with some Map Layers and a Find Address Task that is configured to use a Geocoding Service. This could be an application that you created from scratch in Visual Studio, or one that you created with ArcGIS Server Manager.

After entering an address:

image

The results are shown in the Task Results panel. From there you can right click on an address and choose Zoom To:

image

This will zoom the map to an area centered on the address point. The problem is that scale to which the map is zoomed might not be what you want. Often it’s zoomed out too far.

Solution

To adjust the zoom scale to your liking, add the ZoomToPointFactor property to the esri:TaskResults element on the ASP.NET Page hosting the application.

If you created the application with ArcGIS Server Manager using the default options, this would be found in the Default.aspx file in the C:\inetpub\wwwroot\[YourApplicationName] directory.

Open this file and search for the esri:TaskResults tag, then add the ZoomToPointFactor property and give it a numeric value. In the example below, I’ve set the property to “1000”.

image ArcGIS Server will divide the width and height of the map by this value when zooming to a point. For this example, the zoom area will be 1/1000th of the full extent. The larger the ZoomToPointFactor, the further in that the map will zoom. You will need to experiment to find the ratio that works best, as the full extent can vary greatly depending on the data in your application.

Also note that if you have any cached map services in your application, ArcGIS Server will snap to the cache scale that is closest to the calculated map extent. Consequently, you might not see the map extent change if you don’t modify the ZoomToPointFactor property by a large enough value to jump to another scale.

Resources

Tags: , , ,

.NET | ArcGIS Server | How To | Planet GS | WebADF

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen | Modified by Mooglegiant
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 United States License.

Welcome

James Richards

Hi, I'm James Richards the CTO and co-founder of Artisan Global LLC. We make location-aware mobile apps with maps. I'm the author of QuakeFeed and I helped launch Zaarly at LASW Feb 2011. I also enjoy surfing, snowboarding, golfing, yoga, and music. I love my family: Linda, Sequoya and our cats Remy and Twiggy. Thanks for stopping by, I hope you find something helpful here.

Subscribe by RSS   Follow me on Twitter   Connect on Facebook   View my profile on LinkedIn


Amazon Associates

Some of my posts may contain Amazon Associates links. I only include these links when it makes sense within the context of the article. If you are in the market for one of these items, please consider clicking on an affiliate link to make your purchase. You still get the same great deal from Amazon and it will help me pay for hosting and bandwidth. Thanks!