How to zoom further?

3226
8
05-19-2011 07:14 AM
PaulFrey
New Contributor
Does anyone know of a way to allow a user to be able to zoom down further?  The default zoom extents are certainly far enough for zooming out, but when zooming in you can only go as far as making ESRI's street basemap layer dissapear.  I have a web service running on a flex viewer that deals with villages that have very small parcels, its frustrating to not be able to zoom in close enough to them. 

In short, does anybody know a way to allow a user to zoom in further?

Thank you

-Paul
Tags (2)
0 Kudos
8 Replies
ReneRubalcava
Frequent Contributor
I haven't really thoroughly tested this, but it's working for me so far.
// minimum scale of map
// taken from http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer
private const SCALE:Number = 1128.497176;
private const LEVEL:int = 10;
private var _lods:Array;

// add this event listener somewhere
map.addEventListener(ExtentEvent.EXTENT_CHANGE, onMapExtentChange_handler);

protected function onMapExtentChange_handler(event:ExtentEvent):void
{
 if (map.level)
 {
  if (!map.lods && map.scale > SCALE)
  {
   map.lods = _lods;
   imageServiceLayer.visible = true;
  }
  else if (map.lods && LEVEL === map.level)
  {
   // somewhere in here
   // you will need to turn off any TiledMapServiceLayer
   // that has a minimum scale, like the World_Imagery service
   // if not, this function will just get stuck in a loop
   imageServiceLayer.visible = false;
   _lods = map.lods;
   map.lods = null;
   // need to subtract a minor amout 
   // because map.scale
   // is a number and precision issues
   // were throwing off my map.scale > SCALE
   // comparison above
   map.scale = SCALE - 0.1;
  }
 }
}


In my case, I adjust the lods to only have 10 levels, but you'll want to use however many levels are in your app.
You could probably just assign it from when the Map first loads and grab the map.lods.length and use that value through the rest of your application.

I have been putting off really working on this because the functionality was broken in 2.X up until 2.1 or 2.2 I think, and I just have not gotten around to working it back in.
0 Kudos
BradZedek
New Contributor
Anybody know how to do this without having to use ActionScript code?

I'm using the Flex Viewer and can only edit XML config files.
0 Kudos
AlexSanders
Occasional Contributor
You can add this code to your config file right below the operational layers.

<lods>
          <lod scale="591657527.591555" resolution="156543.03392800014"/>
          <lod scale="295828763.79577702" resolution="78271.516963999937"/>
          <lod scale="147914381.89788899" resolution="39135.758482000092"/>
          <lod scale="73957190.948944002" resolution="19567.879240999919"/>
          <lod scale="36978595.474472001" resolution="9783.9396204999593"/>
          <lod scale="18489297.737236001" resolution="4891.9698102499797"/>
          <lod scale="9244648.8686180003" resolution="2445.9849051249898"/>
          <lod scale="4622324.4343090001" resolution="1222.9924525624949"/>
          <lod scale="2311162.2171550002" resolution="611.49622628137968"/>
          <lod scale="1155581.108577" resolution="305.74811314055756"/>
          <lod scale="577790.55428899999" resolution="152.87405657041106"/>
          <lod scale="288895.27714399999" resolution="76.437028285073239"/>
          <lod scale="144447.638572" resolution="38.21851414253662"/>
          <lod scale="72223.819285999998" resolution="19.10925707126831"/>
          <lod scale="36111.909642999999" resolution="9.5546285356341549"/>
          <lod scale="18055.954822" resolution="4.7773142679493699"/>
          <lod scale="9027.9774109999998" resolution="2.3886571339746849"/>
          <lod scale="4513.9887049999998" resolution="1.1943285668550503"/>
          <lod scale="2256.994353" resolution="0.59716428355981721"/>
          <lod scale="1128.4971760000001" resolution="0.29858214164761665"/>
         </lods>
0 Kudos
BradZedek
New Contributor
Thanks for the reply.

I actually already have that code in my viewer. But can I make it zoom in even further?

I don't understand the relationship between 'scale' and 'resolution' and where these numbers come from.

Thanks!
0 Kudos
haThach
New Contributor III
You could start by add additional scale to your map cache services. I wanted to use Bing services so I add Bing scale level 564.25 to my map cache services.
example:
<lods>
    <lod scale="4622324.434309" resolution="1222.99245256249"/>
    <lod scale="2311162.2171550002" resolution="611.49622628137968"/>
   <lod scale="1155581.108577" resolution="305.74811314055756"/>
   <lod scale="577790.55428899999" resolution="152.87405657041106"/>
   <lod scale="288895.27714399999" resolution="76.437028285073239"/>
   <lod scale="144447.638572" resolution="38.21851414253662"/>
   <lod scale="72223.819285999998" resolution="19.10925707126831"/>
   <lod scale="36111.909642999999" resolution="9.5546285356341549"/>
   <lod scale="18055.954822" resolution="4.7773142679493699"/>
   <lod scale="9027.9774109999998" resolution="2.3886571339746849"/>
   <lod scale="4513.9887049999998" resolution="1.1943285668550503"/>
   <lod scale="2256.994353" resolution="0.59716428355981721"/>
   <lod scale="1128.4971760000001" resolution="0.29858214164761665"/>
   <lod scale="564.25" resolution="0.149291444416222"/>   </lods>

The scale and resolution value are located in your ArcGIS Services Directory. Open the service that you add the scale to than find the value. Hope this help


Ha
0 Kudos
xandermavrides
New Contributor II
You can also re-order your basemap layers. Put Bing at the top and you will be able to zoom in further.  for example:

<basemaps>
            <layer label="Bing" type="bing" visible="true" style="road" culture="en-US" />
            <layer label="Streets" type="tiled" visible="false"  alpha="1"
                  url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
</basemaps>
0 Kudos
PaulFrey
New Contributor
Thanks everyone, these were a big help
0 Kudos
NeoGeo
by
Occasional Contributor III

There are lots of similar posts and it is now 5 years later, but even with LOD's set and Bing listed first, it still says there is no data at the 1:564 level in the viewer, even over the White House, whereas you can zoom in to 1:564 on on Bing's own viewer. 

0 Kudos