Monthly Archives: January 2008

Deconstructing the map cache tiling scheme (Part II): Working with map caches programmatically

This post explains ways to access cached map service tiles programmatically. This is useful if you don’t have access to a Web ADF Map control but you still want to quickly retrieve map images for a certain area. Another reason to retrieve tiles programmatically is if you want to overlay them on other services, such as Google Maps…but that’s a topic for another post. Today we’ll be focusing on how to get a tile of interest.

Before you continue, you should be familiar with how the tiling scheme works. See the archived post Deconstructing the map cache tiling scheme (Part I) if you need a review.

There are lots of ways to retrieve tiles from an ArcGIS Server map cache. The way that you use is affected by several factors which are listed here. This post shows two of the fastest ways to retrieve tiles:

  1. Using a simple HTTP Get request to the virtual cache directory of the Web server
  2. Requesting a tile from the ArcGIS Server map service tile handler

First let’s look at an example of each URL.

Virtual cache directory

If the virtual directory is exposed, you can request a tile from the Web server via the public cache directory. Here’s an example of a URL for a tile retrieved from the virtual cache directory:

Let’s break this URL down.

  • Root URL of one of your virtual cache directories
  • dgaerials: Map service name
  • Layers: The name of the data frame of interest in the map service
  • _alllayers: All layers in the map. This is always the case for single fused caches, if you have a multi-layer cache it will correspond to the specific group layer that was cached in the multi-layer cache
  • L00: Level ID
  • R0000029f: Cache tile row in padded hexadecimal format
  • C00000280.jpg: Cache tile column in padded hexadecimal format

To programmatically discover the virtual cache directory you can call:


Where defaultMapName is the data frame name and layerNumber is -1 for fused caches or the index of the layer of interest for multilayer caches.

Map service tile handler

If the virtual directory is not exposed, you can still request a tile from the web server, but in this case you need to use the map service tile handler. Here’s an example of a URL for a tile retrieved by the map service tile handler:

Here is the breakdown of this URL:

  • URL to the map service of the cache
  • mapName=Layers: Map name of the cached map service
  • format=JPEG: Image type of the cache
  • level=0: Level ID
  • row=671: Cache tile row in decimal format
  • column=640: Cache tile column in decimal format

The SOAP API and cached tiles

The accompanying code example shows how to use the ArcGIS Server SOAP API to get information about a cache and create a URL to retrieve a specific tile. You don’t need any ESRI software installed to program with the SOAP API. You just need a running ArcGIS Server whose services are enabled for Web access. In Microsoft Visual Studio, you can add a Web reference to one of these services and access a number of methods.

If you’re not familiar with adding a Web reference to your project or working with SOAP, you should definitely read the ArcGIS SOAP API Overview. It also explains how the SOAP API uses proxy classes and value objects to expose GIS functionality through Web services. Some of the most important value objects to know about when working with cached map services in the SOAP API are:

  • TileCacheInfo: Contains spatial reference information, as well as the width and height of the tile in pixels.
  • LODInfo: Contains information about the resolution and scale for a level of detail in the cache. You can access an array of LODInfos from TileCacheInfo.
  • TileImageInfo: Contains information about the cache image format

Getting a tile

When using the SOAP API, you might be tempted to get a tile by calling MapServerProxy.GetMapTile( ). It’s actually faster to construct the URL and get the tile directly, as we show in the code example.

Finding the specific tile that covers your point of interest requires a little bit of math. These are some important things to know:

  • The tiling origin

    Remember that the tiling origin is the upper-left point of the tiling scheme grid. You can get it using TileCacheInfo.TileOrigin.

  • The width and height of a tile in ground units

    You can get this by multiplying the tile width (TileCacheInfo.TileCols) or height (TileCacheInfo.TileRows) by the resolution (LODInfo.Resolution)

  • The row and column of your point of interest on the tiling grid

    Columns are zero-based and increase as you move to the right from the tiling origin. Rows are also zero-based and increase as you move down from the tiling origin.

    For example, in the map below, if you were traveling from the tiling origin to Salt Lake City, you would have to move five tiles to the right and four tiles down. This puts Salt Lake City in Column 4, Row 3.

Tiling grid 

Here’s some math you can use to find any tile:

Column = Floor((Point of interest X – Tile origin X) / Ground width of a tile)


Row = Floor((Tile origin Y – Point of interest Y) / Ground height of a tile)


This example application does the following things using the ArcGIS Server SOAP API:

  1. Connects to a map service and discovers whether it has a cache
  2. Computes the number of tiles needed to cover the map horizontally and vertically. This is useful if you have an empty tiling scheme and you want to find out how many tiles will need to be created as part of the caching process.
  3. Creates a URL to get the center tile directly from the virtual cache directory
  4. Creates a URL to get the center tile using the tile handler

See the example application

Download the code (See authors’ comments in Default.aspx.cs)

-Jeremy Bartley and Sterling Quinn

Posted in Services | Tagged , , , , | 3 Comments

ArcGIS Explorer 450 Released

The ArcGIS Explorer Team would like to announce that today, at approximately 3:40 p.m. PST, ArcGIS Explorer 450 was released.

ArcGIS Explorer 450 is an update release that includes the following changes:

  • Fixes problems on startup that have occurred with certain graphics cards and drivers.
  • Fixes symbol display issues that have occurred with certain graphics cards and drivers.
  • Resolves a problem with vector lines flickering when the globe is tilted.

There are no new enhancements, features, or other changes delivered with this release. 

ArcGIS Explorer 450 closely follows the release of ArcGIS Explorer 440. Refer to the What’s New documentation to learn more about the new features delivered with ArcGIS Explorer 440.

If the ESRI servers are your home servers, you’ll be notified that there is a new version available the next time you start the application. Just follow the instructions to download and install this new release. 

For those that deploy Explorer from your own home servers, you’ll need to swap your versions and update your version.html to push out the new release to your users.

- The ArcGIS Explorer Team





Posted in Uncategorized | Tagged | Leave a comment

Custom Task Lifecycles

(by Rob Dunfey, ArcGIS Explorer SDK Development Team)

Custom tasks have many different functions, but for all their differences they have much in common. For example, all custom tasks have a task lifecycle, and as a custom task developer it is important you are aware of what this means, and what it means to your task users.

As a task moves through its lifecycle, its status changes. At any given time a custom task has a status equal to one of six values, as listed in the esriE2TaskStatus enumeration illustrated below.

The current status of a task is displayed in the ArcGIS Explorer results panel when a custom task is pending execution, executing, or has been stopped. A custom task has default messages associated with each status value in the esriE2TaskStatus enumeration.

As a custom task developer you have full control over these messages, and are encouraged to set the message associated with a task status to give appropriate user feedback. For example, the default status message when a task is executing is ‘MyCustomTaskName – executing’ as illustrated below:

Using TaskContext.SetStatusMessage we can change the message associated with the Task executing status:

Having set the status message with the above code, the following is displayed when the task executes:

This message provides more feedback to the user, and is another facet of creating a well-implemented task.

For a comprehensive introduction to the lifecycle of a custom task, view the ArcGIS Explorer TaskContext Lifecycle Diagram which can be found at the ESRI Developer Network (EDN) site as well as in the Explorer SDK Help when you install it.

This is just one of several design patterns you can adopt when developing custom tasks to give your task a familiar look and feel.  More tips and tricks can be found in the new ArcGIS Explorer Custom Task Style Guide.

Posted in Uncategorized | Tagged , , | Leave a comment

The new face of “Ask a Cartographer”

By Charlie Frye, Esri Chief Cartographer

Something we didn’t exactly predict when we originally designed Mapping Center was how useful you would find the Ask a Cartographer page. It wasn’t long before we realized that, in response to your questions, we were answering with lots of tips and tricks, ideas for workflows, and a some FAQs that we thought would be helpful to share. Continue reading

Posted in Mapping | Tagged , | Leave a comment

Optimizing your web services by avoiding per-request impersonation

Here’s a tip that can improve your ArcGIS Server for the Microsoft .Net Framework performance if your web services are receiving many requests over an extended period of time.

When someone makes a request from one of your web services, the web server must authenticate itself with the Server Object Manager (SOM). The web server accomplishes this by impersonating a user in the AGSUSERS group, namely the ArcGIS Web Services account that you entered when you ran the post install. This impersonation doesn’t cost much under light loads, but under heavy loads the Local Security Authority Subsystem Service (Lsass.exe) can become overworked, causing a noticeable lag in performance. Heavy loads are considered 25 or more requests per second.

You can avoid this per-request impersonation by configuring your web services to run in an application pool that runs under the identity of the ArcGIS Web Services account. This lightens the load on the Lsass.exe process and ultimately allows your services to run faster.

These ESRI Knowledge Base articles give additional background on the problem and describe how to make the adjustments to your configuration.

A final note- You’re not as likely to encounter this problem with cached map services because users only need to authenticate with the SOM once, when they initially connect to the service. After that, they can retrieve cache tiles directly from the virtual cache directory.

-Sterling Quinn and Eric Miller

Posted in Services | Tagged , , , | Leave a comment

Using Dynamic Content

ArcGIS Explorer 440 includes enhancements which make it easier to use and manage dynamic layer content from services that are continually being updated, like weather or active fire perimeters.

When you connect to one of these services you have full control over the refresh interval, and with Explorer 440 the cache for dynamic layers is automatically refreshed on open, so you’ll always have the latest information. This now applies to all content sources, including both 2D and 3D services published via ArcGIS Server, 2D services published via ArcIMS, or local vector and raster data.

In this example we’re going to use a weather service provided by Meteorlogix, one of ESRI’s business partners. The Meteorlogix weather information service that ESRI taps into provides updated information every 15 minutes, and the data is being manipulated and stored in an Oracle-based enterprise geodatabase.  As part of the geodatabase input process the data is generalized somewhat (for performance) and cell-based information is aggregated into polygons. As the data is refreshed in the geodatabase it is also being date-stamped, so that historical weather trends can be analyzed using ArcGIS Desktop’s Tracking Analyst.

In ArcGIS Explorer we’re interested in adding this service as a dynamic layer which refreshes automatically. To do this, we connect to the service in Explorer by choosing File, then Open, and selecting Server as the content type we wish to open. 

Below we’ve clicked ArcGIS Server from the Create New Connection choices along the top, and have provided the necessary connection information to connect to the ESRI internal server that is publishing the weather (sorry, we don’t yet publish weather as a publicly accessible service). 

Now that we’ve established a connection to the server, we can scroll down and see the list of published services that are available. Below we’ve chosen to connect to the Meteorlogix weather service that we described above.

Now that we’ve chosen the weather service, we’re guided by a wizard to specify certain parameters. Note that there is a user option to remember what we’ve specified the next time around.

First we’re asked to specify the raster cell size, for which we accept the default chosen by Explorer. Next we’re asked to choose from among the sublayers published in this service. And now to the important part – we’re asked to specify the disk caching options. Since the weather data is updated on the server every 15 minutes, we’ll choose the option for “Don’t create a cache for the layer on disk.” This also enables the choice for refreshing cache based on a time interval, and we’ll specify 15 minutes as the refresh rate.

Using these settings Explorer will communicate with the server and refresh cache for this layer every 15 minutes. If the map is saved, when opened again it will automatically refresh the layer, then refresh at the specified 15 minute interval, ensuring that what you see is up to date.

You can experiment with this yourself using any service or local data source. For a detailed discussion on cache and various cache management options, refer to the Cache management in ArcGIS Explorer Help topic.

Posted in Uncategorized | Tagged , , | Leave a comment

Set legend colors to match feature layer transparency

By Aileen Buckley, Mapping Center Lead

Transparent layer over aerial photo

This question comes in fairly regularly at Ask A Cartographer, so I felt it was time to add a brief blog to use for future queries.  This issue is a common one, and is the topic of a Knowledge Base article that describes the basic steps needed to solve the problem.  The value added here is a bit more discussion as to why this is a necessary workflow. Continue reading

Posted in Mapping, Migrate | Tagged , , , | Leave a comment

Mapping Center Representations Survey

By Charlie Frye, Esri Chief Cartographer

Survey - Thumbnail

We would like your input on how you use cartographic representations.
Why? Well, we’d like to know a bit more about whether and how you use
them in order to better write about them on Mapping Center. Given
your input we hope to provide relevant examples and write our content at the best
level for the largest portion of our audience.

The survey is only twelve questions and should take less than five minutes to complete.

Your help and time are much appreciated. Please click the link below to go to the survey:

Take the Mapping Center Representations Survey


The Mapping Center Team

Posted in Mapping | Tagged , | Leave a comment

ArcGIS Server Code Challenge offers cash prizes for best original code samples

Dollar billsThis week, ESRI announced this year’s ArcGIS Server Code Challenge. If the developer community decides that you’ve submitted one of the top three original code samples, you’ll win a cash prize!

  • First Place—$15,000
  • Second Place—$7,500
  • Third Place—$2,500

The deadline for submissions is February 29, 2008. Winners will be announced at the 2008 ESRI Developer Summit in Palm Springs.

See this page for official information about the Code Challenge including a link to all the rules.

Posted in Services | Tagged , | 2 Comments

Working with Result Groups

ArcGIS Explorer 440 includes result management enhancements, making it easier to manipulate and work with results. One of the enhancements is that you can change the properties for a group of selected results.

You can select or unselect contiguous collections of results by using the <SHIFT> key. You can also add or remove results using the <CTRL> key.

Right-click the results to export the selected set to an NMF, remove them from the list, or edit their properties.

See the Help topics Organizing Results and Result Properties for more information.

Posted in Uncategorized | Tagged | Leave a comment