zooming out

477
2
01-20-2012 06:27 AM
TonyRopson
New Contributor
I am using this service
 
map = new esri.Map("mapDiv");
            var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://lrs.co.columbia.wi.us/ArcGIS/rest/services/LRS/TaxParcels_Parcels/MapServer")
            map.addLayer(layer);
 
var expandFactor = 2500
 newExtent.xmin = newExtent.xmin - expandFactor;
          newExtent.ymin = newExtent.ymin - expandFactor;
              newExtent.xmax = newExtent.xmax + expandFactor;
                newExtent.ymax = newExtent.ymax + expandFactor;
 map.setExtent(newExtent);


I am also getting back the geometry from a query task.  I am wondering if there is a way to set the extent so it is not a standard expand factor but instead will expand out only to include the outlying areas of the returned geometry

edit: This search is showing all the property within a specified number of miles from a point that  the end user selected.  The query task is returning all the geometry of everything with a certain radius.  I am attempting to find a way to have the map zoom out to only show everything within that user specified radius.  So if the end user selects a 40 feet the application just needs to zoom out to show all the area 40 feet around that point.  If the user selects 5280 feet, zoom out to show everything within a mile.  The query task is returning the extent information of all the areas around that point so I am wondering if there is a way to zoom out so the end user can see everything and not have it get cut off when I am using a hard coded number or if I am just basing it off of the number of feet the end user search off of.
0 Kudos
2 Replies
JeffPace
MVP Alum
I am using this service
 
map = new esri.Map("mapDiv");
            var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://lrs.co.columbia.wi.us/ArcGIS/rest/services/LRS/TaxParcels_Parcels/MapServer")
            map.addLayer(layer);
 
var expandFactor = 2500
 newExtent.xmin = newExtent.xmin - expandFactor;
          newExtent.ymin = newExtent.ymin - expandFactor;
              newExtent.xmax = newExtent.xmax + expandFactor;
                newExtent.ymax = newExtent.ymax + expandFactor;
 map.setExtent(newExtent);


I am also getting back the geometry from a query task.  I am wondering if there is a way to set the extent so it is not a standard expand factor but instead will expand out only to include the outlying areas of the returned geometry


you have two options

use the "fit" parameter to force the geometry to fit.   map.setExtent(newExtent, true);

or

use newExtent.expand(1.1) to expand it 1% instead of hardcoding the distance
0 Kudos
TonyRopson
New Contributor
This search is showing all the property within a specified number of miles from a point that  the end user selected.  The query task is returning all the geometry of everything with a certain radius.  I am attempting to find a way to have the map zoom out to only show everything within that user specified radius.  So if the end user selects a 40 feet the application just needs to zoom out to show all the area 40 feet around that point.  If the user selects 5280 feet, zoom out to show everything within a mile.  The query task is returning the extent information of all the areas around that point so I am wondering if there is a way to zoom out so the end user can see everything and not have it get cut off when I am using a hard coded number or if I am just basing it off of the number of feet the end user search off of.    I hope this sheds some more light on what I am attempting to do
0 Kudos